Changing a text file from ".txt" to ".py"

Discussion in 'Programming & Software Development' started by .Anon., Nov 11, 2015.

  1. .Anon.

    .Anon. Member

    Joined:
    Aug 5, 2013
    Messages:
    395
    Sorry if this is in the wrong section, but the noob lounge specifies hardware.

    Trying to teach myself Python, super noob, using beginner tutorials on youtube. long story short my laptop wont let me change the filetype without forcing me to use one of its selected programs. (not python).

    Any idea why this is?
     
  2. SupremeMoFo

    SupremeMoFo Member

    Joined:
    Sep 8, 2007
    Messages:
    5,008
    Location:
    Adelaide
    Open notepad, copy all text in, save as new .py file?
     
  3. neRok

    neRok Member

    Joined:
    Aug 19, 2006
    Messages:
    4,007
    Location:
    Perth NOR
    It might be because you have file extensions turned off, and thus can't properly rename a file.
     
  4. Wolfje

    Wolfje Member

    Joined:
    Jul 9, 2007
    Messages:
    938
    Location:
    Brisbane
    It looks like you're a beginner since you thought the beginner section was a good place to start. No worries, everyone has been new at some point.

    It looks like you have file extensions in explorer hidden. In windows, click the View tab, and check the File name extensions checkbox, which will enable windows explorer to show the hidden .txt extension, so you're then free to change the file extension when you rename the file through your normal methods:

    In Windows 8.1, it looks like this:

    [​IMG]

    Cheers
     
  5. neRok

    neRok Member

    Joined:
    Aug 19, 2006
    Messages:
    4,007
    Location:
    Perth NOR
    I got him sorted out. Python wasn't properly configured in the windows PATH either, so it wasn't working from the command prompt. I think he must have been trying to do it manually, as the docs/blogs circa py-3.2 release suggest, but now the installer can do it for you (just had to reinstall with the option ticked on).
     
  6. OP
    OP
    .Anon.

    .Anon. Member

    Joined:
    Aug 5, 2013
    Messages:
    395
    Thanks to all. Took me an hour to get Python running because it wasn't installing the variables. hopefully not too many stupid questions in the future!
     
  7. DanglingPointer

    DanglingPointer Member

    Joined:
    Feb 19, 2007
    Messages:
    153
    no stupid questions

    There are no stupid questions mate!

    "A journey of a thousand miles starts with a single step"

    Here's a question for you... have you thought of learning python in in linux instead of Windows ? may prove easier...
     
  8. OP
    OP
    .Anon.

    .Anon. Member

    Joined:
    Aug 5, 2013
    Messages:
    395
    I havent, but I also don't really have the means to do that for another week or so, just moved into an apartment and i'm doing this all on my POS laptop. once I get my desktop set up I might give it a crack though(i dont have a desk! lol), why is it easier?
     
    Last edited: Nov 11, 2015
  9. DanglingPointer

    DanglingPointer Member

    Joined:
    Feb 19, 2007
    Messages:
    153
    Many if not all distributions come with python straight off the bat.

    Simply type python or python3 on the command line in Ubuntu for example and it is already there ready for your coding journey!

    If you want to use another python interpreter like PyPy or Jython, simply type...

    Code:
    $ sudo apt-get install pypy
    or
    Code:
    $ sudo apt-get install jython
     

Share This Page

Advertisement: