0
如何從.txt文件中讀取包含所述3個URL的多行,「捲曲」它們以提取HTML並將它們全部輸出到它們各自的python文件中? 我tried-在Python中捲曲並輸出到單獨的文本文件
import commands
import os
import json
# RAW DATA
input = open('uri.txt', 'r')
t_1 = open('command', 'w')
counter_1 = 0
for line in input:
counter_1 += 1
if counter_1 < 3:
filename = str(counter_1)
print str(line)
filename= str(count)
command ='curl ' + '"' + str(line).rstrip('\n') + '"'+ '> ./rawData/' + filename
output_1 = commands.getoutput(command)
input.close()
當我跑我的PyCharm的代碼,它會在我的目錄中的一個空白文件名爲「FILENAME.TXT」
StackOverflow不是一個編碼器出租服務。你試過什麼了?你有沒有對你的問題做過任何研究?你有沒有遇到特定的障礙?請將所有這些信息添加到您的問題。 – KernelPanic
@KernelPanic我已經嘗試了一些東西,我在之前的問題中發佈了我的代碼。我將在這裏添加它 – BCarey
編碼器出租lol – BCarey