Where can I see the command line input to Python?

Asked 2 years ago, Updated 2 years ago, 129 views

Hello.

I'm making a shell by myself, but I don't know how to get a command line factor.

In C, I got argc and argv from the main What should I do with Python?

I'm temporarily receiving raw_input() right now, and if you know the answer, please let me know

api python input command-line-argument

2022-09-22 22:17

1 Answers

The commandline input is located in sys module at sys.argv.

import sys
print sys.argv

To parse the command line, go to optparse or getopt


2022-09-22 22:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.