arguments Printing

#!/usr/bin/python
import sys
print len(sys.argv)
print sys.argv
print sys.argv[1]

Output:

[root@mysql Scripts]# python if.py 3 3
3
['if.py', '3', '3']
3
[root@mysql Scripts]# python if.py 5 3
3
['if.py', '5', '3']
5
[root@mysql Scripts]# python if.py davinder singh
3
['if.py', 'davinder', 'singh']
davinder


Comments

Popular posts from this blog

How to delete SEA in VIOS

Webmin configuration for LDAP

Sample questions and answers for AWS Associate Solutions Architect Certification ---> AWS exam dumps