Looking for Pythonic Examples

2006-02-28 Thread G. Völkl
Hello I am looking for examples of Pythonic Thinking: One example I found: Here some lines of the web side of Bruce Eckel: http://www.mindview.net/WebLog/log-0053 How to read a text file: for line in file(FileName.txt): # Process line It is a easy and sophisticated thing in python, but hard

Re: Looking for Pythonic Examples

2006-02-28 Thread Ido Yehieli
This one is from our very own BDFL, behold- wget implemented in 7 lines of python code: import sys, urllib def reporthook(*a): print a for url in sys.argv[1:]: i = url.rfind('/') file = url[i+1:] print url, -, file urllib.urlretrieve(url, file, reporthook) --

Re: Looking for Pythonic Examples

2006-02-28 Thread Larry Bates
G. Völkl wrote: Hello I am looking for examples of Pythonic Thinking: One example I found: Here some lines of the web side of Bruce Eckel: http://www.mindview.net/WebLog/log-0053 How to read a text file: for line in file(FileName.txt): # Process line It is a easy and sophisticated