Command line interface commands

Question:
In other coding sites there is a command line interface where you can type commands. For the sys.argv function if I want to test my code by inputting a value how would I do that? There is no actual code yet.

Hey @AI2010!

sys.argv is a list, its first item is the file name, followed by a list of inputs.
To give it inputs, you would run your code like this:

python fileIWantToRun.py [inputs]

where inputs would be some strings as inputs.

Example
import sys

print(sys.argv[1])

If this script is run using:

python main.py Hello,world

it will output:

Hello,world
1 Like

And in order to do this:

You would use the Shell tab.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.