5 ms·
urllib is in Python's standard library: import urllib the_page = urllib.urlopen("http://www.gun.io/") print ''.join( the_page.readlines() ) I could jam
by anthonyb 15y ago
urllib is in Python's standard library:
import urllib
the_page = urllib.urlopen("http://www.gun.io/")
print ''.join( the_page.readlines() )
I could jam it all into one line, but in Python we prefer readable code ;) ;)
The Python community also tends to be quieter than those raving Ruby fanbois - if you'd said appeared to be larger, then I would have agreed with you...
- elithrar 15y agoPythonistas should look at the "Requests"[1] lib for Python mentioned here on HN[2] a few days ago, too. [1]: http://docs.python-requests.org/en/latest/ http://docs.python-requests.org/en/latest/ [2]: http://news.ycombinator.com/item?id=3094695 http://news.ycombinator.com/item?id=3094695
- manojlds 15y agoThats what the post linked to talks about.
- anthonyb 15y agoSure, but good to repeat it in this case - Python's urllib/urllib2/etc. libraries are famously hard(er than necessary) to use.
- codygman 15y agoExplicit is better than implicit. I think keeping a bit of the verbose helps people know what's going on. That knowledge is infinitely valuable when debugging certain problems or creating solutions that work well.
- adeelk 15y agoHave you heard of something called Java? ;)
- malkarouri 15y agoA good language, as a good anything, is a reasonable language. Giving extremes as arguments against sensible middle positions is the way of madness, paralysis, or extremism..
- adeelk 15y agoHave you heard of something called Java? ;)
- d0mine 15y agoWhy don't you just use: print the_page.read()