Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie help with input
#8
Now it's a syntax error.

My file reads:

v=input("Enter a value: ")
print (v)

Run it through Python Launcher and the reult is :

Last login: Thu Aug 29 12:44:21 on ttys000
Lous-MacBook-Pro:~ lk$ cd '/Users/lk/Desktop/' && '/usr/bin/pythonw' '/Users/lk/Desktop/sample.py' && echo Exit status: $? && exit 1
Enter a value: I type a value
Traceback (most recent call last):
File "/Users/lk/Desktop/sample.py", line 1, in <module>
v=input("Enter a value: ")
File "<string>", line 1
I type a value
^
SyntaxError: invalid syntax
Lous-MacBook-Pro:Desktop lk$

Q: How do you guys get input in your script's? I've hit a brick wall.

But if I type in "ertwert" it turns into a name error.

Last login: Thu Aug 29 13:02:07 on ttys005
Lous-MacBook-Pro:~ lk$ cd '/Users/lk/Desktop/' && '/usr/bin/pythonw' '/Users/lk/Desktop/sample.py' && echo Exit status: $? && exit 1
Enter a value: ertwert
Traceback (most recent call last):
File "/Users/lk/Desktop/sample.py", line 1, in <module>
v=input("Enter a value: ")
File "<string>", line 1, in <module>
NameError: name 'ertwert' is not defined
Lous-MacBook-Pro:Desktop lk$

Different errors depending upon what is typed in???
Reply


Messages In This Thread
Newbie help with input - by LouK - Aug-28-2019, 09:10 PM
RE: Newbie help with input - by jefsummers - Aug-28-2019, 10:16 PM
RE: Newbie help with input - by Yoriz - Aug-28-2019, 10:21 PM
RE: Newbie help with input - by Malt - Aug-29-2019, 05:59 AM
RE: Newbie help with input - by LouK - Aug-29-2019, 02:00 PM
RE: Newbie help with input - by perfringo - Aug-29-2019, 03:34 PM
RE: Newbie help with input - by LouK - Aug-29-2019, 05:38 PM
RE: Newbie help with input - by LouK - Aug-29-2019, 06:50 PM
RE: Newbie help with input - by LouK - Aug-29-2019, 08:41 PM
RE: Newbie help with input - by onlydibs - Dec-22-2019, 04:12 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Big Grin Newbie to Python - input and branching issue Sherine 3 2,341 Jul-31-2021, 01:09 AM
Last Post: Pedroski55
  Newbie ? Python 3 Input() jlgrunr 1 2,537 Feb-17-2018, 10:26 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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