Python Forum
How do I accept input from the terminal when I execute my file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I accept input from the terminal when I execute my file?
#1
I've been trying to figure this out for a while now.
When I execute my file using python file.py, how can I send input like this: python file.py inputstring?
Reply
#2
name = input('Please enter your name: ')
# for python 2.7 use rawinput()
from command line, place variables after script name, and read in with argv: http://stackoverflow.com/questions/10098...-in-python
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  accept command line argument mg24 5 1,239 Sep-27-2022, 05:58 PM
Last Post: snippsat
  Failed to execute child process (No such file or directory) uriel 1 1,616 Sep-15-2022, 03:48 PM
Last Post: Gribouillis
  How To Set Up And Execute A Python File knight2000 4 1,824 May-31-2022, 10:02 AM
Last Post: Larz60+
  Reading an Input File DaveG 1 1,213 Mar-27-2022, 02:08 AM
Last Post: deanhystad
  Possible to execute a python script before log off/shutdown with input commands? Kaltex 1 2,234 May-18-2021, 06:31 AM
Last Post: Skaperen
  Unable to execute input(). jahuja73 5 4,372 Feb-18-2021, 07:41 AM
Last Post: bowlofred
  Using a .bat file to execute simple anaconda commands in Windows 10 gacg1 0 4,621 Nov-30-2020, 03:24 PM
Last Post: gacg1
  How to assign input file name as logger name Mekala 5 2,789 Aug-05-2020, 12:54 AM
Last Post: Larz60+
  Running input() from mac terminal jdhamblett 2 2,262 Jun-15-2020, 04:10 PM
Last Post: jdhamblett
  I need my compiled Python Mac app to accept a file as a parameter Oethen 2 2,357 May-10-2020, 05:57 PM
Last Post: Oethen

Forum Jump:

User Panel Messages

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