Python Command Line Arguments

Veröffentlicht am: 06 Oktober 2022
auf dem Kanal: Make That Work
261
8

Here's a simple example of passing arguments to your Python scripts via the command line!

To do this, all you have to do is import the sys module and access the argv list (sys.argv). This list contains all the arguments that you give when running your python script from the command line (i.e. python my_script.py ARG_1 ARG_2 etc.). Accessing this list you will then be able to use the elements in your script; whether that's for setting numerical parameters, file names or whatever else you need!


Auf dieser Seite können Sie das Online-Video Python Command Line Arguments mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Make That Work 06 Oktober 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 261 Mal angesehen und es wurde von 8 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!