《网络答案-资料整理》
本期神农:将txt文件中每一列作为文件名来生成空文件(需要将平台提取的网卡名生成对应名称的空文件,用来上课唤醒)
病症现象:懒!!!不想一行一行复制后再一个一个文件生成,生成的文件不是空文件。
网络答案:
import sys,os
a=open("tempmacdata_D502.txt")
n=0
aList=[]
for line in a.readlines():
aList.append(str(line.strip('\n')))
print(aList)
for i in aList:
os.system('@echo > %s'%i)
file = open(i, 'w').close()
服用方法:
将这些文件放在一起静候python魔法发生。