- 博客(4)
- 收藏
- 关注
转载 python shutil.move 移动文件
https://docs.python.org/3.6/library/shutil.html shutil可以实现文件的复制,移动 #复制文件: shutil.copyfile("oldfile","newfile") #oldfile和newfile都只能是文件 shutil.copy("oldfile","newfile") #oldfile只能是文件夹,newfile可以是文件,也可以是目标目录 #复制文件夹: shutil.copytree("olddir","newdir") #olddir
2021-09-21 16:27:16
768
转载 python 获取某个字符指定字符的前面或后面的所有字符内容
要求:获取某个字符指定字符的前面或后面的所有字符内容 示例: url = https://www.baidu.com 想要获取从 “a” 开始的所有字符串内容:aidu.com print url[url.rfind('a'):] 想要获取 “a” 前的所有字符串内容:https://www.b print url[0:url.rfind('a')] 1.作者:Syw 2.出处:http://www.cnblogs.com/syw20170419/ ...
2021-09-21 15:57:20
5564
4
转载 Python:os.path.join()函数
## python路径拼接os.path.join()函数的用法 os.path.join()函数:连接两个或更多的路径名组件 1.如果各组件名首字母不包含’/’,则函数会自动加上 2.如果有一个组件是一个绝对路径,则在它之前的所有组件均会被舍弃 3.如果最后一个组件为空,则生成的路径以一个’/’分隔符结尾 Demo1 import os Path1 = ‘home’ Path2 = ‘develop’ Path3 = ‘code’ Path10 = Path1 + Path2 + Path3 Path20
2021-04-25 19:51:19
258
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅