Answer is in the following, which was suggested by a welcomed viewer. Python argparse: default value or specified value
I need help with overwriting my title from the shell when I run the python program. So far, I just hard code the name inside of the program as below. But, I need an option called -title
which should follow with the new title. It should be an optional option, so if no -title
when running the program, the current title should stay the same. Example would be like:
>python Graph.py -title "New Title"
This should overwrite the old title with the new one. But if I type just
>python Graph.py
It should keep the title as "Old Title".
I surfed the internet and found that I need argument with parser or string. I think using string with argument would work but I am not sure how to make the option optional, so if there is not -title, the title should stay the same.
Right now, I have the following hard coded
plt.title("\n".join(wrap("Performance for "+file1+' & '+file2 +' & '+file3)), size = 12)