0

NOTE: I have posted a very similar question by myself but please note before duplicating this question that the language is different this is a python and that is a shell script. I am making a program in python which needs the user input in the beginning of the program if you don't get my question I will give you an example:

I am making a program which needs the user input in the beginning of the program if you don't get my question I will give you an example:

./script.py "some-input"

So, I want the input in the beginning of the program. I think the input will be stored in a variable. If yes, Then please tell me in which variable it is stored. I am a Python rookie please never hesitate to correct the question. Thank you!

parvezalam khan
  • 480
  • 2
  • 11
lad
  • 233
  • 1
  • 4
  • 14
  • Possible duplicate of [Command Line Arguments In Python](http://stackoverflow.com/questions/1009860/command-line-arguments-in-python) – ZdaR May 17 '17 at 12:23

1 Answers1

2

You can access that variable via:

import sys
sys.argv[1]

more details and examples can be found here

Ohad Eytan
  • 8,114
  • 1
  • 22
  • 31
  • 1
    Thank you, Ohad Eytan! This worked for me!! I will make this as my answer soon. – lad May 17 '17 at 12:25