[root@max ~]vim test.pyvim
import os,syside
for i in range(10):ip
f=file('/test/file%s'%i,'w')it
continue ——for循环批量建立文件for循环
os.system('find /test/ -name file* > test.txt') ——调用系统命令查找重定向class
p=open('test.txt','r').readlines() ——读取文件中全部内容,并定变量test
f=open('test_new.txt','w+') import
for line in p:变量
f.write('max'+line.strip()+'@123.com'+'\n') ——for循环编写新建文件file
[root@max test]# ls
file0 file1 file2 file3 file4 file5 file6 file7 file8 file9
[root@max ~]# cat test.txt
/test/file1
/test/file6
/test/file2
/test/file7
/test/file5
/test/file0
/test/file4
/test/file3
/test/file8
/test/file9
[root@max ~]# cat test_new.txt
max/test/file1@123.com
max/test/file6@123.com
max/test/file2@123.com
max/test/file7@123.com
max/test/file5@123.com
max/test/file0@123.com
max/test/file4@123.com
max/test/file3@123.com
max/test/file8@123.com
max/test/file9@123.com