Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (Retired) Lists Redux Shopping List Take Three

I use Python 2.7.8 and I notice that a function input() can't work with datatype of string. Using raw_input is a must.

I use Python 2.7.8 and I notice that a function input() can't work with datatype of string. Using raw_input is a must. Are there any other ways to use input() in the program rather than using raw_input if python is 2.7.8?

3 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

input() exists in Python 2 but it's stupid. It takes the user's input and then tries to run it as valid, live Python code. This can open you up to all sorts of security issues, as I'm sure you can imagine.

Tobias Edwards
Tobias Edwards
14,458 Points

As far as I know, you can only get input from the user using raw_input() in Python 2.7.8.

I believe python 2.7 only uses raw_input() which was later changed to input() in python 3.3+.