vbs代码: Dim fso,f,a Set fso = CreateObject("Scripting.FileSystemObject") Set f=fso.OpenTextFile("D:\test.txt",1) DO While f.AtEndOfStream <> True a=f.ReadLine msgbox a loop test.txt内容 10899
案例一: 讲数组a 循环写入名称为2.txt的文档中 # -*-coding:utf8-*- import requests from lxml import etree a=[1,2,3,4,5,6] print(a) for i in a: f = open('C:/Users/Beckham/Desktop/python/2.txt','a') f.write('\n'+str(i)) f.close() 脚本执行结果 脚本 f = open('C:/Users/Beckham/Deskt