將1-100循環輸出,並生成一個名爲num.txt的文件python
num = open('num.txt','a') for i in range(1,101): print >> num , i num.close()