PeterGurton
Posts: 7
Joined: Fri Feb 28, 2014 11:24 am

Python code snippets

Sun Mar 09, 2014 12:51 pm

Is there a downloadable Python interpreter that will allow the user to view .py code in a text editor - Word document on a PC for example. One that doesn't want to change all the default programs and install toolbars that I don't want etc...

Many years ago I was doing VB programming and there were loads of user forums that had code snippets that you could just read, and I found this to be a very good way to learn the syntax.

cheers

Peter

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Python code snippets

Sun Mar 09, 2014 1:02 pm

I don't understand the question. Why not just open the script in a text editor?

PeterGurton
Posts: 7
Joined: Fri Feb 28, 2014 11:24 am

Re: Python code snippets

Sun Mar 09, 2014 5:47 pm

Hi, I want to view the code on my laptop (the Pi I am using is not connected to the internet yet), I have downloaded a bunch of code examples that have .py extensions, but when I try to open these I get the "Windows cannot open this type of file" message.

I downloaded a Python Interpreter program, which claims to do what I want, but when I go to install it, I find it has the usual junk that I don't want - free video chat etc...

I am new to this so any advice would be greatly appreciated.

Cheers

Peter

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Python code snippets

Sun Mar 09, 2014 5:51 pm

Can't you just left-click on the '.py' file once to highlight it in Windows Explorer, then right-click once and select 'Open with...' and choose Notepad?
Last edited by GTR2Fan on Sun Mar 09, 2014 5:54 pm, edited 1 time in total.
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Python code snippets

Sun Mar 09, 2014 5:52 pm

Editpad Light opens python code with no problems
http://www.editpadlite.com/download.html
it's also not sensitive to dos (crlf) vs unix (lf only) text files.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

PeterGurton
Posts: 7
Joined: Fri Feb 28, 2014 11:24 am

Re: Python code snippets

Sun Mar 09, 2014 7:42 pm

Thanks everyone for your help: Right click, then selecting Word from the 'choose default program' works fine and includes the code indents. FYI, Notepad puts it all on one line - awkward to read, but it's all there; WordPad breaks it down into individual lines but doesn't include the line indents.

Cheers

Peter

Return to “Beginners”