案例一: 讲数组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