摘要:
import os path=r'/Users/mac126/Desktop/openstudy/路径.py' result=os.path.split(path) print(result)#截取文件夹 与文件名,以元组形式存在 result=os.path.splitext(path) #截取文件后缀,以元组形式存在 print(result) size=os.path.getsize(pat 阅读全文
摘要:
import os path1=os.path.dirname(__file__) path=os.path.dirname('/Users/mac126/Desktop/openstudy/images/girl.jpg') path2=os.path.join(path1,) print(path1,path) r=os.path.isabs('/Users/mac126/Desktop/... 阅读全文
摘要:
这种错误是递归错误,知道问题原因就好解决了 上面是一个典型的有入口没终点的案例,运行程序就会一直跑下去,当跑到一定程度就会报递归错误。 成功的案例 阅读全文
摘要:
my_name='zhangsan' print(f"Let's talk {my_name},Don't paly basketball in the room") #等价于下面方式 print("Let's talk {},Don't paly basketball in the room".format(my_name)) #打印结果如下: ''' Let's talk zhangsan,D 阅读全文