And*_*ndo 1 python multiplying
我正在使用Python 2.当我尝试将列表中的对象相乘时,即使我尝试使用它来解决问题,它也会重复相同的事情两次:
map(float, prices)
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码是:
import urllib
from bs4 import BeautifulSoup
prices = []
htmlfile = urllib.urlopen("http://www.fifacoin.com/default/quick/listwithcategoryid? category_id=6").read()
soup = BeautifulSoup(htmlfile)
for item in soup.find_all('tr', {'data-price': True}):
prices.append(item['data-price'])
map(float, prices)
print prices[1] * 2
Run Code Online (Sandbox Code Playgroud)
这段代码只输出价格2的值.我是Python的新手,所以它可能是显而易见的