Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python with arguments
#2
This will give you a good start.

#!/usr/bin/env python

# reading arguments given on the command line when script invoked
# (if invoked with nothing after script name, will generate a failure)
import sys     # import module that provides command line arguments
x = sys.argv   # assign to x a list of the command line arguments
print(x[1])    # print the 2nd argument (first will be name of involved script)
I am trying to help you, really, even if it doesn't always seem that way
Reply


Messages In This Thread
python with arguments - by haye - Oct-10-2017, 11:35 AM
RE: python with arguments - by gruntfutuk - Oct-10-2017, 11:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems passing arguments containing spaces to bash script and then on to python kaustin 6 484 Apr-03-2024, 08:26 PM
Last Post: deanhystad
  How do I handle escape character in parameter arguments in Python? JKR 6 1,283 Sep-12-2023, 03:00 AM
Last Post: Apoed2023
Question log.exception() without arguments in old Python versions? cthart 5 1,229 Nov-19-2022, 07:09 PM
Last Post: Gribouillis
  changing the process command line arguments in python Skaperen 3 3,055 Aug-19-2019, 02:40 PM
Last Post: wavic
  python 3.8 and positional arguments vojo 4 2,841 Jun-10-2019, 10:00 PM
Last Post: DeaD_EyE
  Printing arguments in python console. Narendra 1 2,002 Jan-28-2019, 12:00 AM
Last Post: Larz60+
  Functions (Arguments Passing,Changing a mutable ,Assignment to Arguments Names) Adelton 2 3,914 Mar-02-2017, 10:23 PM
Last Post: zivoni

Forum Jump:

User Panel Messages

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