+ 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

11th Aug 2020, 9:20 PM
Edward Finkelstein
Edward Finkelstein - avatar
4 ответов
+ 3
sys.argv is the list of arguments: first arg is the path of the python file other are other args
12th Aug 2020, 8:45 AM
Sousou
Sousou - avatar
+ 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
12th Aug 2020, 8:43 AM
Sousou
Sousou - avatar
+ 3
Edward Finkelstein No problem ;)
12th Aug 2020, 6:51 PM
Sousou
Sousou - avatar
+ 2
thank you!
12th Aug 2020, 3:28 PM
Edward Finkelstein
Edward Finkelstein - avatar