[Tutor] Read from large text file, parse, find string, print string + line number to second text file.
Mitya Sirenef
msirenef at lightbird.net
Sat Feb 2 05:54:34 CET 2013
On 02/01/2013 11:31 PM, Scurvy Scott wrote:
>
> Steve-
> thanks a lot for showing me the if __name__ = main part
> I've often wondered how it was used and it didn't make sense until I
> saw it in my own code if that makes any sense.
> Also appreciate the help on the "instructional" side of things.
>
> One question related to the instruction aspect- does this make sense
to you?
>
> If len(sys.argv) == 0:
> print "usage: etc etc etc"
If should not be capitalized; sys.argv always has the name
of the script as the first item.
So you need to do something like:
if len(sys.argv) != 3:
print "usage: ..."
HTH! -m
--
Lark's Tongue Guide to Python: http://lightbird.net/larks/
Emotion is primarily about nothing and much of it remains about nothing to
the end. George Santayana
More information about the Tutor
mailing list