python

[Python] Two ways to import a module

# Option 1: we have to specify 'sys'
import sys

if len(sys.argv) == 1:
    print("No arguments specified")
    print("This is the name of the script:", sys.argv[0] )


# Option 2
from sys import argv
if len(argv) == 1:
    print("No arguments specified")
    print("This is the name of the script:", argv[0] )
Was this helpful?