0
我想創建一個腳本,查看文件,讀取每行(這是url)併爲我獲取HTTP標題。 我有問題: 我嘗試將結果重定向到文本文件,但無論如何,我嘗試,它不工作。Python 3.3 - 獲取標題並重定向結果
有人可以幫我用我的代碼嗎?
import urllib.request
import sys
open('sorti.txt','w')
sorti = open("sorti.txt",'w')
print('Creation de sorti.txt')
text_file = open ("id.txt", "r")
text_file.read().strip('\n')
for lines in text_file:
urllib.request.urlopen('lines').write.sorti()
header = urllib.request.parse_http_list(lines).write.sorti()
sys.stdout(sorti)
text_file.close
sorti.close
你試過了嗎?它工作? – Salem 2013-06-03 18:19:41