Python for Mac OSX 10.10.2

Discussion in 'Mac Programming' started by kevinh6673, Feb 5, 2015.

  1. kevinh6673 macrumors newbie

    Joined:
    Feb 5, 2015
    #1
    I am a complete noob to this. Actually trying to work through some of this for a class I am taking. We are using python to right protocols for networking assignments.

    So I have installed Python 3.4.2. I go to right a very simple code and it isn't working. x = raw_input ("enter your name: "). The issue I am having is, it will not allow me to enter "_", the underscore.

    Thank you for the help.

    Kevin
     
  2. JustMartin macrumors 6502a

    Joined:
    Feb 28, 2012
    Location:
    UK
    #2
    So, are you doing this in Python directly - that is, did you open a terminal session and issue the python command and then try your x= at the prompt? When you say 'Won't let you _' does it just not appear on the screen or does it complain in some other way

    Have you tried 'input' instead of raw_input?
     
  3. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #3
    raw_input() is Python 2.x

    It's just input() in Python 3.x

    If you're working with someone else or doing this as an assignment, I would check which version of Python it should be done in.

    If you're doing this for yourself, feel free to use whichever version. I stick with 2.7.x because everything is compatible with it - sometimes I have to use old libraries that aren't compatible with 3.x.
     
  4. lukeg01 macrumors newbie

    Joined:
    Jun 23, 2014
    #4
    Hello
    This is because you use python 3.x I recommend sticking to 2.x cause like everything on the internet in written in it.
     

Share This Page