1
我是一位設計研究員。我有包含75-100報價,而我給了各種標籤,像這樣幾個.txt文件:美麗的湯:列出所有屬性
<q 69_A F exercises positive> Well I think it’s very good. I thought that the exercises that Rosy did was very good. I looked at it a few times. I listened and I paid attention but I didn’t really do it on the regular. I didn’t do the exercises on a regular basis. </q>
我想嘗試列出所有的標籤(「69_a」「練習」,「積極」)通過使用beautifulsoup。但不是給我的輸出看起來像這樣:
69_a
exercises
positive
這是給我的輸出看起來像這樣:
q
q
q
q
Finished...
能否請你幫我解決這個問題?我有很多定性數據,我希望通過這些。目標是將所有引號導出到.xlsx文件並使用數據透視表進行排序。
from bs4 import BeautifulSoup
file_object = open('Angela_Q_2.txt', 'r')
soup = BeautifulSoup(file_object.read(), "lxml")
tag = soup.findAll('name')
for tag in soup.findAll(True):
print(tag.name)
print('Finished')
是你問這是什麼不清楚。請使用您的問題上的[編輯](http://stackoverflow.com/q/36597494/3100115)鏈接來顯示您的文件內容和預期輸出的樣本。 – styvane