[Tutor] REPL format

Jim Mooney cybervigilante at gmail.com
Sun Apr 26 01:38:33 CEST 2015


I'm curious why, when I read and decode a binary file from the net in one
fell swoop, the REPL prints it between parentheses, line by line but with
no commas, like a defective tuple. I can see breaking lines visually, at
\n, but if the parentheses don't mean anything I can't see including them.
Or do they mean something I've missed? Also, it's interesting that although
HTML is case-free, you have to get the case right for the java server page.
getbusesforroute.jsp doesn't work.

?import urllib.request
u = urllib.request.urlopen('
http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22')
data = u.read()
f = open('rt22.xml', 'wb')
f.write(data)
f.close()

f = open('rt22.xml', 'rb')
transit_info = str(f.read(), encoding='utf-8')

>>> transit_info
('<?xml version="1.0"?>\r\n'
 '\r\n'
 '\r\n'
 ... bunch of stuff ...
 '\t\t\t<wid2>222</wid2>            \t\r\n'
 '\t\t</bus>\r\n'
 '\r\n'
 '\r\n'
 '\r\n'
 '\t</buses>\r\n')



-- 
Jim

If you only had one hour left to live, would you spend it on Facebook,
Twitter, or Google Plus?


More information about the Tutor mailing list