Newbie NameError problem
Sion Arrowsmith
siona at chiark.greenend.org.uk
Wed Dec 12 12:38:29 EST 2007
<MartinRinehart at gmail.com> wrote:
>I don't understand what I don't understand in the following:
> [ ... ]
You've already got an answer as to what's causing your name error.
But that's not your only problem. It looks like you need an
introduction to enumerate():
for line_ptr, text in enumerate(file('sample_decaf.d')):
for char_ptr, char in enumerate(text):
# whatever you want to do with your chacter-by-character
# processing with line and charater positions
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list