使用OS下载python第三方库:
import os
libs = {"numpy","matplotlib","pillow","sklearn","requests",\
"jieba","beautifulsoup4","wheel","networkx","sympy",\
"pyinstaller","django","flask","werobot","pyqt5",\
"pandas","pyopengl","pypdf2","docopt","pygame",\
"tensorflow","wordcloud"}
try:
os.system("python.exe -m pip install --upgrade pip")
for lib in libs:
os.system("pip install -i https://pypi.douban.com/simple "+lib)
os.system("pip list")
print("Successful")
except:
print("Failed Somehow")
使用OS和pandas遍历目录,将文件名称以excel输出:
import os import pandas as pd def files_search(path): data=os.listdir(path) datas=pd.DataFrame(data) datas.to_excel('xxxxx') if __name__ == '__main__': files_search('xxxxx')