开发者

Convert to a urllib.request to an integer

Am I able to convert the value us_price into an integer after the following:

import urllib.request

page = urllib.request.urlopen ("http://au.finance.yahoo.com/q?s=AUDUSD=X")
text = page.read().decode("utf8")

where1 = text.find('yfs_l10_audusd=x">')

start_of_u开发者_StackOverflow中文版s_price = where1 + 18
end_of_us_price = start_of_us_price + 6

us_price = text[start_of_us_price:end_of_us_price]

I have tried usp = int(us_price) to no avail


You probably should use float(us_price), but if you want int then int(float(us_price)).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜