Not able to take input in python

0 votes

Python input error:

I am trying to run a python script and take input but I am getting this error:

Enter the name: a
Traceback (most recent call last):
  File "socket_scanner.py", line 6, in <module>
    target = input('Enter the name: ')
  File "<string>", line 1, in <module>
NameError: name 'a' is not defined

Code:

import pandas
name = input(‘Enter the name’)
Jan 31, 2019 in Python by Tarun
3,715 views
Which version of python are you using?
I don’t know. I am new to python. I just downloaded Ubuntu and python was already installed.

Run this command in the terminal to find the python version:

python --version
$ python --version
Python 2.7.15rc1

1 answer to this question.

0 votes

You are using python 2 in which input() function doesn’t work. Wherever there is input(), use raw_input().

answered Jan 31, 2019 by Omkar
• 69,220 points
Thanks, it worked for me

Related Questions In Python

0 votes
1 answer

Unable to take input from user in Python

num = input("enter number") print(num) READ MORE

answered May 1, 2018 in Python by aayushi
• 750 points
797 views
0 votes
1 answer

How to write "not equal" in python?

The keywords is and is not are ...READ MORE

answered Sep 18, 2018 in Python by SayantiniDeb
• 200 points
2,427 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,466 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,127 views
+1 vote
3 answers
+3 votes
2 answers

how to print array integer without [] bracket in python like result = 1,2,3,4,5

Hey @abhijmr.143, you can print array integers ...READ MORE

answered Aug 5, 2018 in Python by Omkar
• 69,220 points

edited Aug 8, 2018 by Omkar 8,194 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP