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
  501 Server cannot accept argument anna17 0 173 Apr-11-2024, 01:08 AM
Last Post: anna17
  How to accept facebook cookies using python selenium? pablo86ad 0 171 Apr-06-2024, 09:19 PM
Last Post: pablo86ad
  accept command line argument mg24 5 1,296 Sep-27-2022, 05:58 PM
Last Post: snippsat
  Failed to execute child process (No such file or directory) uriel 1 1,651 Sep-15-2022, 03:48 PM
Last Post: Gribouillis
  How To Set Up And Execute A Python File knight2000 4 1,893 May-31-2022, 10:02 AM
Last Post: Larz60+
  Reading an Input File DaveG 1 1,247 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,260 May-18-2021, 06:31 AM
Last Post: Skaperen
  Unable to execute input(). jahuja73 5 4,441 Feb-18-2021, 07:41 AM
Last Post: bowlofred
  Using a .bat file to execute simple anaconda commands in Windows 10 gacg1 0 4,675 Nov-30-2020, 03:24 PM
Last Post: gacg1
  How to assign input file name as logger name Mekala 5 2,843 Aug-05-2020, 12:54 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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