Created
December 19, 2013 01:25
-
-
Save frodopwns/8032779 to your computer and use it in GitHub Desktop.
gets the cny to usd exchange rate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = 'http://www.webservicex.net/currencyconvertor.asmx/ConversionRate?FromCurrency=CNY&ToCurrency=USD' | |
r = requests.get(url) | |
data = r.text | |
data = data.split("\n")[1] | |
spos = data.find('">') + 2 | |
epos = data.find("</", spos) | |
xrate = float(data[spos:epos]) | |
print xrate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment