标签:blog os for div on log ef as 服务器
1.###test how to write a list into txt
def write_txt(): file = open("write_test.txt", "w") a = [1,2,3,4] for i in a: file.write("posi%d ne %d\n"%(i, i)) file.close()
注意写完之后要close()
我看有的地方说那write的括号里面是%s,但是其实%d也是可以的。
这样子就可以将服务器的运行结果记录在txt中
标签:blog os for div on log ef as 服务器
原文地址:http://www.cnblogs.com/hope100/p/4034400.html