Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Through command line arguments. You can parse either manually or (preferably) with argparse .
An example of how to access the list of given arguments if you still want to parse yourself:
import sys
print(sys.argv)
Call the script with input redirection <<< or <<
For example, to pass a single string:
or for multiple strings:
$ script.py <<_END_
some input string 1
some input string 2
some input string 3
_END_
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question