Thread: Tutorials?
View Single Post
Old Aug 26th, 2004, 10:34 AM   #11
clifford.will
Newbie
 
Join Date: Aug 2004
Location: Florida
Posts: 11
Rep Power: 0 clifford.will is on a distinguished road
exactly B)

plus there is lots of code out there to read through to get an idea of how it should and should not be written.

I think one of the neatest things about the language is the ability to slurp a file into an array according to the lines in the file in two or three lines of code. Can't do that in C .... C++, yes, if you use the STL, but even then, it's not as clean and understandable. Plus you can filter the lines that you want in the same operation in Python -- that I know you can't do with C++.

ex.

import re

r = re.compile('^MyMatch', re.IGNORECASE)
f = open('my.dat', 'r')
lines_I_want = [ x for x in f if r.match(x) ]
f.close()

sweeeeeet
clifford.will is offline   Reply With Quote