[Tutor] a quick Q: how to use for loop to read a series of files with .doc end

Alan Gauld alan.gauld at btinternet.com
Thu Oct 6 11:18:17 CEST 2011


On 06/10/11 04:54, lina wrote:

>     If you use IDLE, the standard IDE that comes with Python, you should
>     find that hitting tab (or pausing briefly) in a file editor will
>     bring up a pick list of options.
>
> Just tried the  idle-python2.6,
> Q1: Is it bound with certain python version, such as for python3, do I
> need get idle-python3 ?

Yes, you need IDLE for V3.
IDLE is a python program itself so in theory you could run earlier 
versions but the version for V3 uses V3 syntax so you need to match the 
versions. If you are using Linux your package manager should have an 
IDLE v3 package available.


> Q2: how to use the last command I input, such as I typed something wrong
> and I wanna correct in the next step.

Use Alt-p(previous) to go back through history
Use Alt-n(next) to go forward.
You can also cursor up to the command you want(or use the mouse) and hit 
return to bring it into the prompt.

> seems no much difference with using terminal directly. I might be wrong
> here.

You get syntax colouring and auto indentation as well as the tool tips.
There is a slight "bug" in the interactive window in that the alignment 
is off for some statements(*) but if typing code into a file it all 
works fine.


(*)
 >>> if True:
	x = 42
else:
	y = 42


Notice the else is out of line with if because of the >>>


Other features of IDLE are a graphical debugger that allows you to step 
through your code line by line, A syntax checker, a class browser(for 
when you get into objects). There is also a "code context" option but I 
have no idea what it does!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list