当前位置: 首页 > news >正文

东莞市做网站的公司哪家好企业建站程序哪个好

东莞市做网站的公司哪家好,企业建站程序哪个好,东莞的公司,企业网络营销方案策划shutil模块 针对文件的拷贝#xff0c;删除#xff0c;移动#xff0c;压缩和解压操作 # 1.copyfileobj只能复制文件内容#xff0c;无法复制权限#复制文件时#xff0c;要选择自己有权限的目录执行操作#xff0c;创建的文件会根据系统umask设定的参数来指定用户权限 s…shutil模块 针对文件的拷贝删除移动压缩和解压操作 # 1.copyfileobj只能复制文件内容无法复制权限#复制文件时要选择自己有权限的目录执行操作创建的文件会根据系统umask设定的参数来指定用户权限 shell [studentserver1 tmp]$ ll /etc/passwd -rw-r--r-- 1 root root 2.7K 7月 15 09:02 /etc/passwd #----------------------------------------------------------- with open(/etc/passwd, moder) as fr:with open(/tmp/mypasswd,modew) as fw:shutil.copyfileobj(fr,fw) #----------------------------------------------------------- [studentserver1 tmp]$ ll /tmp/mypasswd -rw-rw-r-- 1 student student 2.7K 11月 6 10:53 /tmp/mypasswd # 2.copyfile只能复制文件内容无法复制权限 shell [studentserver1 tmp]$ ll /tmp/myresolv.conf -rw-rw-r-- 1 student student 53 11月 6 11:01 /tmp/myresolv.conf #--------------------------------------------------------- shutil.copyfile(/etc/resolv.conf,/tmp/myresolv.conf) #--------------------------------------------------------- [studentserver1 tmp]$ ll /etc/resolv.conf -rw-r--r-- 1 root root 53 11月 6 07:52 /etc/resolv.conf # 3.copy将文件src复制到文件或目录dst,包含权限 [studentserver1 tmp]$ ll /etc/hosts -rw-r--r-- 1 root root 674 10月 31 09:50 /etc/hosts #--------------------------------------------------------- shutil.copy(/etc/hosts,/tmp/myhosts) #--------------------------------------------------------- [studentserver1 tmp]$ ll /tmp/myhosts -rw-r--r-- 1 student student 674 11月 6 11:04 /tmp/myhosts # 4.move递归将文件或目录移动到另一个位置并返回目标 [studentserver1 tmp]$ ll /tmp/myhosts -rw-r--r-- 1 student student 674 11月 6 11:04 /tmp/myhosts #--------------------------------------------------------- shutil.move(/tmp/myhosts,/home/student/hosts.move) #--------------------------------------------------------- [studentserver1 tmp]$ ll /tmp/myhosts ls: 无法访问 /tmp/myhosts: 没有那个文件或目录 [studentserver1 tmp]$ ll /home/student/hosts.move -rw-r--r-- 1 student student 674 11月 6 11:04 /home/student/hosts.move # 5.copytree递归复制以src为根的整个目录树返回目标目录由dst命名的目标不能存在(存在会报错)复制时注意文件目录权限 shutil.copytree(/home/student,/tmp/security) ---------------------------------------------------------- # 6.rmtree删除整个目录树路径必须指向目录空目录或者非空目录都可使用 [studentserver1 test]$ ll 总用量 8.0K -rw-r--r-- 1 student student 674 11月 6 11:28 hosts -rw-r--r-- 1 student student 53 11月 6 11:28 resolv.conf # ----------------------------------------------------------- shutil.rmtree(/tmp/test) # ------------------------------------------------------------ [studentserver1 test]$ ll 总用量 0 # 7.copymode复制权限将权限位从src复制到dst,文件内容所有者和组不受影响 [studentserver1 test]$ ll 总用量 4.0K -rw-r--r-- 1 student student 674 11月 6 11:35 hosts [studentserver1 test]$ ll /etc/shadow ---------- 1 root root 1.5K 8月 12 06:52 /etc/shadow #---------------------------------------------------- shutil.copymode(/etc/shadow,/tmp/test/hosts) #---------------------------------------------------- [studentserver1 test]$ ll 总用量 4.0K ---------- 1 student student 674 11月 6 11:35 hosts # 8.chown更改路径的所有者用户和组 [studentserver1 test]$ ll 总用量 4.0K -rwxrwxrwx 1 student root 674 11月 6 11:35 hosts # --------------------------------------------------- shutil.chown(/tmp/test/hosts,userstudent,groupstudent) # ------------------------------------------------------------ [studentserver1 test]$ ll 总用量 4.0K -rwxrwxrwx 1 student student 674 11月 6 11:35 hosts os 模块 print(当前工作目录%s%os.getcwd()) print(进程ID%d %os.getpid()) print(父进程ID%d %os.getppid()) print(系统环境变量%s%os.environ) print(获取uname信息%s%str(os.uname())) print(CPU核数%s%os.cpu_count()) print(查看当前目录下的文件%s%os.listdir(.)) os.chdir(/tmp/) os.makedirs(./first) print(当前目录%s%os.getcwd()) # remove删除文件 [studentserver1 first]$ pwd /tmp/first [studentserver1 first]$ ll 总用量 0 -rw-rw-r-- 1 student student 0 11月 6 14:48 a.txt # ------------------------------------------------ os.remove(first/a.txt) # ------------------------------------------------ [studentserver1 first]$ ll 总用量 0 # rmdir只能删除空目录 os.rmdir(first) print(获取路径中携带的文件名%s%os.path.basename(/tmp/test/abc)) print(获取路径中携带的文件目录%s%os.path.dirname(/tmp/test/abc)) #split(),路径切割从最右边/开始 print(os.path.split(/tmp/test/abc)) #join()路径拼接 print(os.path.join(/tmp/test,abc)) # 判断路径是否为绝对路径 print(os.path.isabs(/tmp/test/abc)) # 判断路径是否为相对路径 print(os.path.isdir(tmp/test/abc)) # 判断是否为文件 print(os.path.isfile(tmp/test/abc)) # 判断是否为链接文件 print(os.path.islink(tmp/test/abc)) # 判断文件是否存在 print(os.path.exists(tmp/test/abc))
http://www.sadfv.cn/news/172797/

相关文章:

  • 大良营销网站建设讯息宁波网站推广优化公司怎么样
  • 网站免费正能量软件wordpress 文章 接口
  • 厦门网站建设兼职有必要买优化大师会员吗
  • 网站样式模板下载滨州建网站
  • 非常赚又一个wordpress站点wordpress中文界面
  • 网站建设者创业项目网站建设规划
  • 做网站还有意义搜索引擎优化方案模板
  • 肇庆网站建设方案外包小程序推广有哪些好的方法
  • 为什么网站显示乱码红圈工程项目管理软件
  • 信息发布平台推广有哪些宁波seo排名外包公司
  • 企业网站可以做游戏类网站么wordpress5.0.3
  • 服务器可以做几个网站品牌logo设计说明
  • 聊城住房和城乡建设厅网站电子商务网站的整体规划
  • 竞价网站模板创意包装设计网站
  • 网站如何申请微信支付功能静态网站有哪些
  • 网站开发计入什么费用二级建造师执业资格考试
  • 平山做网站优化wordpress 主题 星球
  • 大连精美网站制作做一个网站APP价格
  • 印象笔记同步wordpress企业网站seo数据
  • 建设部网站刘赵云前端开发网站开发
  • 网站后台管理系统怎么做的网站 源文件
  • 网站建设结构图下载杭州高端响应式网站
  • 杭州网站建设网页制作房县建设局网站
  • 有没有像一起做网店做男装的网站厦门建设局人员名单
  • 网站建设企业站模板有哪些熟悉的网站是jsp做的
  • jsp网站开发实例.百度网盘wordpress 原创模板
  • 网站产品管理模块网站的结构设计
  • 西安建站网站wordpress 文章h标签美化
  • 桂林建设信息网站网站设置密码进入
  • 电视台网站建设网站 锚点链接怎么做