I started learning Python today. I have several java programs that collect/copy content from many webpages in the internet, they work great, but they use a lot of memory, and I need that memory.
Also it’s always fun to learn something new and I always hear the best things about Python, which is easy and fun. And so far I agree with that!
So the first thing I looked up was:
How to read the contents of a page using Python:
import urllib print urllib.urlopen('http://www.r00t.gr/').read()
Same works with ftp:
import urllib print urllib.urlopen('ftp://ftp.python.org/pub/python/README').read()
That’s it. When I saw that i though “holly shit that was it ?”
In java I had to get a Scanner, create an output stream, loop, use a stringbuffer […]
So far I LOVE this language. Let’s hope I finally replace Java.