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
692 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,030 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
158 views
0 votes
1 answer

How to write "not equal" in python?

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

answered Sep 17, 2018 in Python by SayantiniDeb
• 200 points
769 views
+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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,560 views
0 votes
0 answers
+4 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,800 points
1,177 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 4, 2018 in Python by Omkar
• 69,030 points

edited Aug 8, 2018 by Omkar 4,754 views