[Tutor] switch-case in python

2006-02-28 Thread
I know this may seem to be stupid. but as I found that there's no switch-case control flow in python, an I just can't remember( or know) any method to make such a control flow. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/

[Tutor] replacing spaces and tabs before the code

2005-11-06 Thread
I am try to write a code that turn codes to html file I do it like this,(It is take out from example code form sourceforge): re_lead=re.compile(r"[\f\t]") re_space=re.compile(r"[ ]{2,}") src = re_lead.sub(r" ",src) src = re_lead.sub(r" ",src) src is the code string!

Re: [Tutor] encode question!

2005-09-27 Thread
tutor-request Thanks Ziyad.You answer is exactly the realson it is! I am missdirect by the coding of the html. the %25 in the url is the '%' char in file name. after urllib.unquote('xvg_h%25202.jpg') 'xvg_h%202.jpg' That's the real filename I want! thanks too, Danny Yoo! >This has n

[Tutor] encode question!

2005-09-26 Thread
I am trying to write a stript that extract jpg files from a html I had downloaded.I encounter a problem with a Big5 charset html file.Big5 used in Hongkong ans Taiwan. In this html file there's a jpg names "xvg_h%202.jpg" in vi ,the tag of the image is

Re: [Tutor] Tk canvas question

2005-08-23 Thread
>You can use the itemcget() method of the canvas to retrieve the text: > > >>> root = Tk() > >>> canvas=Canvas(root) > >>> t=canvas.create_text(10, 10, text='Hello', tag='1') > >>> canvas.pack() > >>> canvas.itemcget('1', 'text') >'Hello' > >There does seem to be something strange with reusing the

[Tutor] Tk canvas question

2005-08-22 Thread
I am writing a resource manager like program ! the files of directory is display on canvas and taged. the tag and file name is keep in a dictionary! The tag is a increaseing number from 1,so I build the dictionary like (1:file1,2:file2,..). While geting into another directory,I try to remov

[Tutor] how to run pdb in idle

2005-08-12 Thread
I am a newbie to python.I use pdb in command line quite well. In idle, I open the tree.py file, and type: >>>pdb.run('tree.py') > (1)?() (Pdb) l [EOF] (Pdb) list 10 [EOF] (Pdb) As you see, it didn't work as it was in comand line. Can some body tell me why? (tree.py was a file download from n