python_os_learning

python_os_learning

 

 

 

# author: Roy.G
import os
# y1=os.getcwd()
# print(y1,type(y1))
# y2=os.chdir("E:\\pythonlearning_2")
# print(y2)
#
# os.makedirs("E:\\a\\b\\c\\")
# os.removedirs("E:\\a\\b\\c\\")
# # os.mkdir()
# # os.rmdir()
# y3=os.listdir(".")
# print(y3)

# y4=os.environ
# print(y4)
# for i in y4.keys():
# print(i,":",y4[i])
# y5=os.sep
# print(y5)

# y6=os.linesep
# print("--------")
# print(y6)
# print("--------")
# y7=os.pathsep
# print(y7)

# y8=os.name
# print(y8)
#
# y9=os.system("ipconfig")
# print(type(y9))
# print(y9)

# os.path(__file__)

# y10=os.path.split(r"E:/A/B/C/A.TXT")
# print(y10)
# y11=os.path.basename(r"E:/A/B/C/A.TXT")
# print(y11)
# y12=os.path.exists(r"E:/A/B/C/A.TXT")
# print(y12)
# y13=os.path.isabs(r"E:/A/B/C/A.TXT")
# y14=os.path.isabs("/A/B/C/A.TXT") #in linux with "/"as root
# print(y13,y14)

y15=os.path.isfile(r"E:/A/B/C/A.TXT")
print(y15)

 

上一篇:os.path主要方法汇总


下一篇:HACKNOS_ OS-BYTESEC