PASSING USER INPUT FROM COMMAND PROMPT IN PYTHON
I have this simple python code saved in my desktop in the folder named as "Python".
You can see I run the file named "Running_from_cmd.py" from the command prompt. And it shows the correct output. What if I want to pass the input from cmd and the cmd or the IDE shows the output. So for that we have to pass the arguments to the same command line as shown below:
The code in the IDE should be this:
argv stands for Argument values and here I have passed the index value of 1 because index value 0 indicates the file name which is Running_from_cmd.py in the command line. 6 is the index value 1 and 4 is the index value 2. The same value passes to the IDE and the output is shown accordingly.
Leave PASSING USER INPUT FROM COMMAND PROMPT IN PYTHON to:
Read more #hive-114105 posts
Best Posts From Leo Umesh
We have not curated any of leoumesh's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Leo Umesh
- The Tattoo of My Newborn Baby Girl Forever Inked on My Skin
- Long Weekend Food Feast With Wife
- String Manipulation in C#: Part 2
- String Manipulation in C#
- Introduction to C# and .NET
- Weekend Escape To Falls
- Evening Barbecue With Favourite Beer 🍺 🍻
- NumPy Broadcasting
- Summer BBQ
- Review of "The Day of The Jackal" Series