The lines below are the essence of a 2.6 script that gets the current
USD/yen quote.

I'd like to convert the script to 3.1, but I can't understand the docs
for the 3.1 urllib module. Please someone tell me what to do.
(Converting   'print rate'   to   'print(rate)'   I understand.)

import urllib2
a = 
urllib2.urlopen('http://www.marketwatch.com/investing/currency/CUR_USDYEN').read(20500)
b = a[19000:20500]
idx_pricewrap = b.find('pricewrap')
context = b[idx_pricewrap:idx_pricewrap+80]
idx_bgLast = context.find('bgLast')
rate = context[idx_bgLast+8:idx_bgLast+15]
print rate

Thanks,

Dick Moores
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to