python灭霸的响指
作者:互联网
python灭霸的响指
闲来无事,做了个简单的snap小程序。可以在指定地点(C盘 )打响指,随机消灭一半的文件。自己试了试,感觉还蛮好玩。不多说了,我要赶紧抢救系统文件了。
import os
import shutil
import random
def find_victim(universe):
path_domain=os.listdir(universe)
for i in range(len(path_domain)):
path_domain[i]=universe+'/'+path_domain[i]
return path_domain
def find_lucky(victim):
random.shuffle(victim)
return victim
def Thanos_snap(lucky): #Snap it!!!For death queen!!!
for i in range(int(len(lucky)/2)):
shutil.rmtree(lucky[i])
def main():
universe='D:/snap_test' #想要在哪打响指?
victim=find_victim(universe)
lucky=find_lucky(victim)
Thanos_snap(lucky)
if __name__ == '__main__':
main()
效果:
snap前
snap后
标签:响指,python,universe,lucky,victim,path,snap,domain,灭霸 来源: https://blog.csdn.net/weixin_45435206/article/details/106631452