Python Forum
How to receive two passed cmdline parameters and access them inside a Python script?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to receive two passed cmdline parameters and access them inside a Python script?
#1
Sorry for this newbie question:

Assume I have have a python script myscript.py (on Windows 10).

Now I want to call this script (from command line) and pass two parameters (separrted by blanks) e.g.

myscript.py "D:\tools\input data.txt" 65656

The parameters may or may not enclosed in double quotes (as above).

How can I access these passed parameters from inside the script?
Say I want to echo/output them (=the values) simply on command line.

It would be nice to get a sample script.

Thank you
Peter
Reply


Messages In This Thread
How to receive two passed cmdline parameters and access them inside a Python script? - by pstein - Feb-17-2024, 08:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to receive rtmp video in Python? aksdjfh 0 482 Feb-27-2025, 02:58 PM
Last Post: aksdjfh
  Extract args=, value that was passed to Multiprocessing.Proc object during runtime? haihal 1 703 Dec-08-2024, 07:04 AM
Last Post: Gribouillis
  sharepoint: Access has been blocked by Conditional Access policies CAD79 0 2,381 Jul-12-2024, 09:36 AM
Last Post: CAD79
  Script problem - Illegal access to removed OSM object MarcPolo72 0 1,071 Jun-23-2024, 04:26 PM
Last Post: MarcPolo72
  Guidance for the basic concept send/receive a heartbeat signal StefanL38 1 1,873 Jun-09-2024, 05:31 PM
Last Post: Gribouillis
  [SOLVED] [listbox] Feed it with dict passed to class? Winfried 3 1,397 May-13-2024, 05:57 AM
Last Post: Larz60+
  Receive Input on Same Line? johnywhy 8 2,881 Jan-16-2024, 03:45 AM
Last Post: johnywhy
  How to continuously receive messages until specified to stop using Bleak jacobbreen25 3 4,336 Dec-28-2022, 04:25 PM
Last Post: jacobbreen25
  How can I add an end line character after every value that I receive? GiggsB 11 9,010 Mar-06-2022, 08:51 PM
Last Post: GiggsB
  mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python ilknurg 3 7,944 Jan-18-2022, 06:25 PM
Last Post: ilknurg

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020