Re: [Tutor] Regular expression grouping insert thingy

2010-06-08 Thread Lang Hurst
Oh. Crap, I knew it would be something simple, but honestly, I don't think that I would have gotten there. Thank you so much. Seriously saved me more grey hair. Matthew Wood wrote: re.sub(r'(\d+)x', r'\1*x', input_text) -- I enjoy haiku but sometimes they don't make sense; refrigerator?

Re: [Tutor] Regular expression grouping insert thingy

2010-06-08 Thread Matthew Wood
re.sub(r'(\d+)x', r'\1*x', input_text) -- I enjoy haiku but sometimes they don't make sense; refrigerator? On Tue, Jun 8, 2010 at 10:11 PM, Lang Hurst wrote: > This is so trivial (or should be), but I can't figure it out. > > I'm trying to do what in vim is > > :s/\([0-9]\)x/\1*x/ > > That is

[Tutor] Regular expression grouping insert thingy

2010-06-08 Thread Lang Hurst
This is so trivial (or should be), but I can't figure it out. I'm trying to do what in vim is :s/\([0-9]\)x/\1*x/ That is, "find a number followed by an x and put a "*" in between the number and the x" So, if the string is "6443x - 3", I'll get back "6443*x - 3" I won't write down all the t

Re: [Tutor] Extract from file

2010-06-08 Thread Monte Milanuk
On 6/8/10 5:44 PM, Manju wrote: Hi, I need help with extracting information from file. I have a file which is a comma delimited text file containing separate line for each booking. Each line is composed of date, room number, course number and course day. Course day??? Not sure what you meant

[Tutor] Extract from file

2010-06-08 Thread Manju
Hi, I need help with extracting information from file. I have a file which is a comma delimited text file containing separate line for each booking. Each line is composed of date, room number, course number and course day. I need to extract only the room number which is entered at t

Re: [Tutor] Tkinter - master attribute

2010-06-08 Thread Alan Gauld
"Jim Byrnes" wrote in When reading code examples I see things like theframe.master.title('spam) def __init__(self, master): frame = Frame(master) When I encounter these I tend to get bogged down trying to decide if "master" has special meaning or is just a name the author has cho

Re: [Tutor] Tkinter - master attribute

2010-06-08 Thread Steven D'Aprano
On Wed, 9 Jun 2010 02:38:28 am Jim Byrnes wrote: > When reading code examples I see things like > theframe.master.title('spam) or > def __init__(self, master): > frame = Frame(master) > > When I encounter these I tend to get bogged down trying to decide if > "master" has special meaning or is

[Tutor] Tkinter - master attribute

2010-06-08 Thread Jim Byrnes
When reading code examples I see things like theframe.master.title('spam) or def __init__(self, master): frame = Frame(master) When I encounter these I tend to get bogged down trying to decide if "master" has special meaning or is just a name the author has chosen. For example is it simila

Re: [Tutor] no. of references

2010-06-08 Thread Payal
Hi all, Excuse for TOFU. Thanks a lot Steven, Dave and Hugo. Steven the explanation was really great. Thanks a lot for it. Hugo, I was just curious, have no real need. Thanks. With warm regards, -Payal -- On Tue, Jun 08, 2010 at 08:07:28PM +1000, Steven D'Aprano wrote: > On Tue, 8 Jun 2010 04:

Re: [Tutor] no. of references

2010-06-08 Thread Hugo Arts
On 8 jun 2010, at 08:08, Payal wrote: > Hi, > If I have a list (or a dict), is there any way of knowing how many > other > variables are referencing the same object? > In short, not in any compatible way. If you have a bounded list of names, you can check them with the is operator. But the quest

Re: [Tutor] no. of references

2010-06-08 Thread Dave Angel
Payal wrote: Hi, If I have a list (or a dict), is there any way of knowing how many other variables are referencing the same object? With warm regards, -Payal Depends on what you mean by variables. Try sys.getrefcount(mylist) Naturally, the count will be one higher than you expect. And

Re: [Tutor] no. of references

2010-06-08 Thread Steven D'Aprano
On Tue, 8 Jun 2010 04:08:15 pm Payal wrote: > Hi, > If I have a list (or a dict), is there any way of knowing how many > other variables are referencing the same object? Sort of. The question is simple, but the answer isn't. It depends what you mean by "variables", and it requires a good understa

Re: [Tutor] accented characters to unaccented

2010-06-08 Thread Peter Otten
KB SU wrote: > Hi, > > I have open url and read like following: > > $import urllib > $txt = urllib.urlopen("http://www.terme-catez.si";).read() > $txt > If you see above, in junk of HTLM, there is text like 'Terme > \xc4\x8cate\xc5\xbe' (original is 'Terme Čatež'). Now, I want to convert > cod