Looking for Pythonic Examples

  • Thread starter =?iso-8859-1?Q?G._V=F6lkl?=
  • Start date
?

=?iso-8859-1?Q?G._V=F6lkl?=

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 to do or more complicated in other languages
like java.

Does anyone know more examples ?

Does anyone know books about real good python programming ?

Best Regards

Gerhard
 
I

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)
 
L

Larry Bates

G. Völkl said:
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 to do or more complicated in other languages like java.

Does anyone know more examples ?

Does anyone know books about real good python programming ?

Best Regards

Gerhard

Pick up a copy of the Python Cookbook, it is full of examples.

-Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top