Re: [Tutor] regexp

2011-11-07 Thread Peter Otten
Asokan Pichai wrote: > IMO the regex is not too bad; I will not use it for this job -- typing > a 50+ character string > is more painful (and more error prone) than writing 5--10 lines of code. Well, you can build the string programmatically: >>> "*".join(string.ascii_lowercase) + "*" 'a*b*c*d*e

Re: [Tutor] regexp

2011-11-07 Thread Albert-Jan Roskam
Nice solution indeed! Will it also work with accented characters? And how should one incorporate the collating sequence into the solution? By explicitly setting the locale? It might be nice if the outcome is always the same, whereever you are in the world.   Cheers!! Albert-Jan ~~

Re: [Tutor] regexp

2011-11-07 Thread Peter Otten
Albert-Jan Roskam wrote: > Nice solution indeed! Will it also work with accented characters? And how > should one incorporate the collating sequence into the solution? By > explicitly setting the locale? It might be nice if the outcome is always > the same, whereever you are in the world. This is

[Tutor] Handling exceptions

2011-11-07 Thread Gerhardus Geldenhuis
Hi I am trying to handle exceptions for a xmlrpc class interfacing with cobbler. The exception: xmlrpclib.Fault: and the experimental code. try: server = xmlrpclib.Server("http://192.168.2.11/cobbler_api";) #... except xmlrpclib.Fault as detail: print 'xmlrpc error' prin

Re: [Tutor] Handling exceptions

2011-11-07 Thread Hugo Arts
On Mon, Nov 7, 2011 at 12:52 PM, Gerhardus Geldenhuis wrote: > Hi > I am trying to handle exceptions for a xmlrpc class interfacing with > cobbler. > The exception: >  xmlrpclib.Fault: test_profile'"> > > and the experimental code. >   try: >     server = xmlrpclib.Server("http://192.168.2.11/cob

Re: [Tutor] Handling exceptions

2011-11-07 Thread Steven D'Aprano
Gerhardus Geldenhuis wrote: try: server = xmlrpclib.Server("http://192.168.2.11/cobbler_api";) #... except xmlrpclib.Fault as detail: print 'xmlrpc error' print detail #print detail.arguments print repr(detail) I don't understand what I am getting from the exception

Re: [Tutor] Having trouble visiting the subscribers list.

2011-11-07 Thread Alexander
On Sat, Nov 5, 2011 at 9:24 PM, Steven D'Aprano wrote: > Nathaniel Trujillo wrote: > >> I recently subscribed to tutor and I am trying to visit the subscribers >> list so I can ask a question but I wasn't given an admin address. Not only >> that but I don't know what an admin address is. Your hel

Re: [Tutor] Printing with no newline :(

2011-11-07 Thread Sarma Tangirala
On 6 November 2011 21:09, Alan Gauld wrote: > On 06/11/11 10:23, Sarma Tangirala wrote: > > I'm sorry. Didn't notice the python 3 part, I just joined the list and >> did not look at the OPs post. Sorry about that. >> > > welcome to the list :-) > > > Please bear with me on this, but does the fo

Re: [Tutor] Printing with no newline :(

2011-11-07 Thread Prasad, Ramit
>> for line in file: >> m = re.search(regexp, line) >> if m: >> letterGroup = m.group(0) >> print(letterGroup[4]) >You can specify what to print after the argument(s) with the end keyword >parameter: items = 1, 2, 3 for item in items: >... pr

[Tutor] Single line webserver

2011-11-07 Thread Rich Lovely
Hi all, I was part of this list a couple of years ago, and a recent discussion at a python dojo brought to mind something I'd seen then: a one-liner (potentially single statement) webserver. I'm pretty sure it was posted to this list, but I can't find it in the archives, and a google search is

[Tutor] Writing the Map function as a oneliner

2011-11-07 Thread Rafael Turner
Hello, I am trying to write the map function as a oneliner. I currently have implement map as a list comprehension: map = lambda F,li: [F(x) for x in li] But I would like to make recursive version. Here is what I was thinking: I can write map as def pyMap(F,li): if li == []: return

Re: [Tutor] Single line webserver

2011-11-07 Thread Steven D'Aprano
Rich Lovely wrote: Hi all, I was part of this list a couple of years ago, and a recent discussion at a python dojo brought to mind something I'd seen then: a one-liner (potentially single statement) webserver. I'm pretty sure it was posted to this list, but I can't find it in the archives, a

Re: [Tutor] Single line webserver

2011-11-07 Thread Alan Gauld
On 07/11/11 23:23, Rich Lovely wrote: a one-liner (potentially single statement) webserver. There is a python module in the standard library that implements a basic webserver, presumably it was based on that. Try the docs for the library modules... -- Alan G Author of the Learn to Program

Re: [Tutor] Writing the Map function as a oneliner

2011-11-07 Thread Alan Gauld
On 07/11/11 23:32, Rafael Turner wrote: Hello, I am trying to write the map function as a oneliner But I would like to make recursive version. Here is what I was thinking: I can write map as def pyMap(F,li): if li == []: return [] else: return [F(li[0])] + map2(

[Tutor] tkfiledialogs and hidden files

2011-11-07 Thread Jose Amoreira
Hello! Is there any way to configure tkFileDialogs so that they don't display hidden files? Thanks. Ze Amoreira ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Question about GUI applications.

2011-11-07 Thread Nathaniel Trujillo
I just wrote the following GUI application. How do I get rid of the 7k in the upper left hand corner and how to I put other stuff there like say a picture of someone. Thanks for the help. Here is the GUI application. It is called mad_lib.py.py # Mad Lib # Create a story based on user input from t

Re: [Tutor] Single line webserver

2011-11-07 Thread Lie Ryan
On 11/08/2011 10:23 AM, Rich Lovely wrote: Hi all, I was part of this list a couple of years ago, and a recent discussion at a python dojo brought to mind something I'd seen then: a one-liner (potentially single statement) webserver. I'm pretty sure it was posted to this list, but I can't fi