Please any one suggest me to how to give command line arguments without raw_input() with examples? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Please any one suggest me to how to give command line arguments without raw_input() with examples?

I need to give command line arguments while running python script. Any one suggest me?

26th Jan 2017, 6:58 PM
Mohan
2 Respostas
+ 2
Do you mean... ...using a file as user input? http://stackoverflow.com/a/28573935/3981745 (On SoloLearn you'd simulate this by pre-writing an 'Answer File' from the same Python program.) If you need raw_input() to work instead of simulating the "same thing" using file reads you have to redirect the input stream. It would use stdin instead of stdout/stderr you can see here: https://code.sololearn.com/c6NQFsmNHz82/?ref=app ...command line arguments (not related to raw_input)? https://www.tutorialspoint.com/python/python_command_line_arguments.htm (Not compatible with SoloLearn's input processor) ...more than one raw_input chance? SoloLearn basically creates an answer file and submits it to Python with static parameters. The best you can do is enter multiple lines (up to 100 chars; or use my first link). ...Something else?
26th Jan 2017, 7:26 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
You could also have Python request input from a webserver that responds with web_input()-compatible form values: https://learnpythonthehardway.org/book/ex51.html Due to SoloLearn's kill timeout this is probably an external solution.
26th Jan 2017, 7:48 PM
Kirk Schafer
Kirk Schafer - avatar