User Tools

Site Tools


python:pythonbasicexamples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
python:pythonbasicexamples [2020/02/26 16:01] – [Read and Update File] adminpython:pythonbasicexamples [2022/10/29 16:15] (current) – external edit 127.0.0.1
Line 220: Line 220:
 </code> </code>
 ===== Python Command Line Arguments ===== ===== Python Command Line Arguments =====
 +refer: https://www.tutorialspoint.com/python/python_command_line_arguments.htm
 +
 Consider we want to pass two file names through command line and we also want to give an option to check the usage of the script. Usage of the script is as follows − Consider we want to pass two file names through command line and we also want to give an option to check the usage of the script. Usage of the script is as follows −
 <code bash> <code bash>
Line 256: Line 258:
 $ test.py -h $ test.py -h
 </code>output:<code> </code>output:<code>
-usage: test.py -i <inputfile> -o <outputfile>+test.py -i <inputfile> -o <outputfile>
 </code> </code>
   * Option2:<code bash>   * Option2:<code bash>
-$ test.py -i BMP -o 
- 
-usage: test.py -i <inputfile> -o <outputfile> 
- 
 $ test.py -i inputfile $ test.py -i inputfile
 +</code>output:<code>
 Input file is " inputfile Input file is " inputfile
 Output file is " Output file is "
 +</code>
python/pythonbasicexamples.1582732891.txt.gz · Last modified: 2022/10/29 16:15 (external edit)