+ 2
Python Code Output
Can someone explain the output of this code? import sys sys.path.append("modules/") import math print ("Number of arguments:", len(sys.argv), "arguments.") print ('Argument List:', str(sys.argv)) https://code.sololearn.com/cb2X5bqk6fW6/#py
4 ответов
+ 3
sys.argv is the list of arguments:
first arg is the path of the python file
other are other args
+ 3
import sys #imports sys module
sys.path.append("modules/") #adds modules/ folder to sys.path (now you can import python files from that folder)
import math #imports math module
print ("Number of arguments:", len(sys.argv), "arguments.")
#prints the number of arguments passed to python
print ('Argument List:', str(sys.argv))
#prints the arguments passed to python
+ 3
Edward Finkelstein No problem ;)
+ 2
thank you!