我有此鏈接:如何拆分字符串並將其打印在不同的行中?
http://www.downloadcrew.com/article/14769-free_studio
我有這樣的代碼:
import urllib
from bs4 import BeautifulSoup
import time
url = "http://www.downloadcrew.com/article/14769-free_studio"
pageUrl = urllib.urlopen(url)
time.sleep(2)
soup = BeautifulSoup(pageUrl)
for b in soup.select("h1#articleTitle"):
a = b.contents[0].strip()
print "app_name: "+a
輸出是:
app_name: Free Studio 2013 v6.1.12.925
但我需要的輸出是這樣的:
app_name: Free Studio 2013
version: v6.1.12.925
我該怎麼辦可能做到這一點?
請添加python標籤 –
這是什麼意思? @KDawG –
除了python-2.7和beatifulsoup標籤之外,還增加了一個python標籤使其能夠查看更多觀衆 –