I've been trying to grab a price from BTC-E price API,I can't just specify price[109:116] for example. because it will just print 2 numbers in the wrong format if such happened. I just need to grab whats after "last:"
from urllib2 import Request, urlopen, URLError
def btceapi():
request = Request('https://btc-e.com/api/2/btc_usd/ticker')
try:
response = urlopen(request)
price = response.read()
print price[109:116]
except URLError, e:
print 'Not Found'
btceapi()