I am familiar with C, and have started experimenting in python. My question is regarding the sys.argv
command. I\'ve read it is used for a command line interpre
Beware of performing comparisons involving command-line arguments, which can lead to really unexpected behavior owing to Python 2's policy for comparing objects of different types ('int' < 'list' < 'string' < 'tuple') as noted here. In Python 3, comparing objects of different types will lead to a TypeError.
For an example of object comparison mayhem, try removing the int()
call in section 6.1.1. of the Python tutorial Fibonacci code and you'll get an infinite loop, since the while loop condition becomes: 'int' < 'string'. (This would not happen in Perl, btw).
Great advice from @Jan-Philip above to validate command-line arguments, even for Python 3.