Python Forum
Question on babynames.py solution code?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question on babynames.py solution code?
#1
I am reading the Google Python crash course, where they give you a challenge to open .html files that contain tables of popular baby names in a given year, sort the babynames alphabetically, and return a list with the sorted names and corresponding names. The solution code is given in the link below:
https://github.com/mlafeldt/google-pytho...bynames.py

Please explain to me what the purpose of "--summaryfile" is. I know that sys.argv represents the list of arguments that you include when typing "babynames.py" into the Command Prompt. I also know that sys.argv[0] is, for me at least, the directory path to the babynames.py program.

In the solution, is "--summaryfile" expected to be replaced by an actual file name?
Thanks for your help.
Reply
#2
Oftentimes, you can try code to get an answer:
>>> print('usage: [--summaryfile] file [file ...]')
usage: [--summaryfile] file [file ...]
>>>
Author is showing how to use the program
so it would be :
python babynames.py --summaryfile mybabyfilename
Reply
#3
Thanks. I suppose it is saying that you have the option to write it to a summary file by specifying that string as your first argument (after the program name/filepath).
Reply
#4
yes indeed.
But note that he also expects you to modify the code if you wish run an other way,
Quote:# +++your code here+++
# For each filename, get the names, then either print the text output
# or write it to a summary file
# LAB(begin solution)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  please looking for typo in my code (solution please) jamie_01 1 1,239 Jan-12-2022, 06:45 AM
Last Post: Gribouillis
  Newbie - code solution explained Stjude1982 2 1,790 Sep-16-2021, 08:54 AM
Last Post: Stjude1982
  Quick Help - Timers - Need Small Solution for Working Code EwH006 5 3,975 Nov-17-2020, 04:09 AM
Last Post: EwH006
  need solution to code mccluregamer4472 9 3,881 Mar-04-2019, 12:40 AM
Last Post: mccluregamer4472
  Multiplication Recursive Solution - What's Going On Inside the Code? emerger 1 2,592 Mar-04-2018, 07:11 AM
Last Post: ka06059

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020