[Tutor] Cannot understand what this means
#PATHANGI JANARDHANAN JATINSHRAVAN#
JATINSHR001 at e.ntu.edu.sg
Mon Jul 15 10:53:27 CEST 2013
Hello All,
I have just started out with python and was feeling pretty comfortable and confident to the point of solving problems from websites. But now, there is a program from Google's Python Exercises whose main() part is already given to you.
def main():
# This command-line parsing code is provided.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print 'usage: [--summaryfile] file [file ...]'
sys.exit(1)
# Notice the summary flag and remove it from args if it is present.
summary = False
if args[0] == '--summaryfile':
summary = True
del args[0]
The problem is one where you have to define a function to read a html file containing the 1000 most popular baby names of a particular year(separate files for different years) and print each name in alphabetical order with their corresponding rank for that year.
My problem is that I cannot understand anything in this main() module. Nothing at all. So can somebody please explain what this means and what is its significance?
Thank You
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130715/a195b471/attachment-0001.html>
More information about the Tutor
mailing list