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
19 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.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 65,850 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
17 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
40 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,710 points
61 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,500 points
14 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
25 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
• 65,850 points

edited Aug 8, 2018 by Omkar 277 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.