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 in Python by Tarun
43 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 by Omkar
• 67,460 points

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
31 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
83 views
0 votes
1 answer

How to use not equal operator in python

Use !=. See comparison operators. For comparing object identities, ...READ MORE

answered Dec 20, 2018 in Python by charlie_brown
• 7,720 points
104 views
0 votes
1 answer

How do I check if input string is a valid regular expression or not in Python?

Hi. Good question! Well, just like what ...READ MORE

answered Feb 12 in Python by Nymeria
• 3,520 points
72 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 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 226 views
+4 votes
6 answers
0 votes
2 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
• 67,460 points

edited Aug 8, 2018 by Omkar 644 views