我想在底部湊這個頁面的持股表,讓每列中的信息:https://www.sec.gov/Archives/edgar/data/1412093/000114036111027807/0001140361-11-027807.txt如何在文本文件中解析表格?
我到目前爲止是這樣的:
from bs4 import BeautifulSoup
import urllib2
import datetime
import sys
def scrape(url):
htmlfile = urllib2.urlopen(url)
htmltext = htmlfile.read()
bs = BeautifulSoup(htmltext)
tables =bs.find_all('table')
for table in tables:
print table
if __name__ == '__main__':
url = 'https://www.sec.gov/Archives/edgar/data/1412093/000114036111027807/0001140361-11-027807.txt'
scrape(url)
然而,這隻能讓我看到桌子,而我似乎無法進一步逐行解析它。 任何幫助,這將不勝感激,謝謝!
那麼,你知道如何找到表,所以下一步找到行... – davidism