Re: [Tutor] Demystification of Lambda Functions

2015-10-28 Thread Steven D'Aprano
On Tue, Oct 27, 2015 at 09:04:45PM -0400, Hunter Jozwiak wrote: > Hello, > > I am not sure exactly why there would be a practical use for a lambda > function, other than the fact that you can make one-liner functions that > take parameters in to a variable. Or at least that is how things look

[Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Flynn, Stephen (L & P - IT)
Afternoon, Python 3. I'm iterating through a list and I'd like to know when I'm at the end of the said list, so I can do something different. For example list_of_things = ['some', 'special', 'things'] for each_entry in list_of_things: print(each_entry) if

[Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Vusa Moyo
Hi Guys, I've written a script to remove vowels from a string/sentence. the while loop I'm using below is to take care of duplicate vowels found in a sentence, ie anti_vowel('The cow moos louder than the frog') It works, but obviously its messy and n00by. Any suggestions on how I can write

Re: [Tutor] Are there any Python-based GUI builders for tkinter

2015-10-28 Thread Laura Creighton
In a message of Tue, 27 Oct 2015 15:20:56 -0500, boB Stepp writes: >I have a friend at work and he is trying to develop GUI applications >in Python, but he does not want to hand-code them. Are there any >commercial or non-commercial products that would do this for him? He >tried his own online

Re: [Tutor] Demystification of Lambda Functions

2015-10-28 Thread Laura Creighton
In a message of Tue, 27 Oct 2015 21:04:45 -0400, "Hunter Jozwiak" writes: >Hello, > > > >I am not sure exactly why there would be a practical use for a lambda >function, other than the fact that you can make one-liner functions that >take parameters in to a variable. Or at least that is how

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Zachary Ware
On Wed, Oct 28, 2015 at 10:09 AM, Vusa Moyo wrote: > Hi Guys, > > I've written a script to remove vowels from a string/sentence. > > the while loop I'm using below is to take care of duplicate vowels found in > a sentence, ie > > anti_vowel('The cow moos louder than the frog') >

Re: [Tutor] Are there any Python-based GUI builders for tkinter (fwd)

2015-10-28 Thread Laura Creighton
Ooops, didn't send this to the list. sorry. Laura --- Forwarded Message >Laura, > >I checked out QtCreator but see zero sign of it supporting python - even tried >a search and the only hit was a job opening. Am I missing something? > > >Jon Paris The Qt Creator announcment for the 2.8.0

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Zachary Ware
On Wed, Oct 28, 2015 at 11:09 AM, Zachary Ware wrote: >assert remove_vowels('Did It work? Looks like.') == 'Dd t wrk? Lks Lke.' Of course I typo'd here (that's what you get for not testing!): there should be no final 'e' and the last 'L' should be lower-case.

Re: [Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Peter Otten
Flynn, Stephen (L & P - IT) wrote: > Afternoon, > > Python 3. > > I'm iterating through a list and I'd like to know when I'm at > the end of the said list, so I can do something different. For example > > list_of_things = ['some', 'special', 'things'] > for each_entry in list_of_things: >

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Peter Otten
Vusa Moyo wrote: > I've written a script to remove vowels from a string/sentence. > > the while loop I'm using below is to take care of duplicate vowels found > in a sentence, ie > > anti_vowel('The cow moos louder than the frog') > > It works, but obviously its messy and n00by. Any

Re: [Tutor] Demystification of Lambda Functions

2015-10-28 Thread Peter Otten
Steven D'Aprano wrote: > Sometimes callbacks are particularly short and simple. Suppose you are > programming a calculator, and you have ten buttons 0...9 which all do > precisely the same thing: they add their own name to the calculator > display: > > > for num in range(0, 10): > btn =

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alan Gauld
On 28/10/15 16:37, Peter Otten wrote: 'The cow moos louder than the frog'.translate(str.maketrans("", "", "aeiouAEIOU")) 'Th cw ms ldr thn th frg' Even easier, forget the maketrans stuff and just use 'The cow moos louder than the frog'.translate(None,'aeiouAEIOU') -- Alan G Author of the

[Tutor] export pandas excel

2015-10-28 Thread Lucas Mascia
Hello, Attached is my program, I have filtered some data from an extensive table from excel. I have it running for two names: ps_sol = ["Mauro Cavalheiro Junior", "Aline Oliveira"] > for name in ps_sol: > At the end I am trying to export to another .xlsx file. But it is only saving the

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alex Kleider
On 2015-10-28 09:37, Peter Otten wrote: Vusa Moyo wrote: I've written a script to remove vowels from a string/sentence. the while loop I'm using below is to take care of duplicate vowels found in a sentence, ie anti_vowel('The cow moos louder than the frog') It works, but obviously its

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alan Gauld
On 28/10/15 17:35, Peter Otten wrote: Alan Gauld wrote: On 28/10/15 16:37, Peter Otten wrote: 'The cow moos louder than the frog'.translate(str.maketrans("", "", "aeiouAEIOU")) 'Th cw ms ldr thn th frg' Even easier, forget the maketrans stuff and just use 'The cow moos louder than the

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Peter Otten
Alan Gauld wrote: > On 28/10/15 16:37, Peter Otten wrote: > > 'The cow moos louder than the frog'.translate(str.maketrans("", "", >> "aeiouAEIOU")) >> 'Th cw ms ldr thn th frg' > > Even easier, forget the maketrans stuff and just use > > 'The cow moos louder than the

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Peter Otten
Alex Kleider wrote: > On 2015-10-28 09:37, Peter Otten wrote: >> Vusa Moyo wrote: >> >>> I've written a script to remove vowels from a string/sentence. >>> >>> the while loop I'm using below is to take care of duplicate vowels >>> found >>> in a sentence, ie >>> >>> anti_vowel('The cow moos

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alex Kleider
On 2015-10-28 08:09, Vusa Moyo wrote: Hi Guys, I've written a script to remove vowels from a string/sentence. the while loop I'm using below is to take care of duplicate vowels found in a sentence, ie anti_vowel('The cow moos louder than the frog') It works, but obviously its messy and

Re: [Tutor] Are there any Python-based GUI builders for tkinter

2015-10-28 Thread Mark Lawrence
On 28/10/2015 08:39, Laura Creighton wrote: In a message of Tue, 27 Oct 2015 15:20:56 -0500, boB Stepp writes: I have a friend at work and he is trying to develop GUI applications in Python, but he does not want to hand-code them. Are there any commercial or non-commercial products that would

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Zachary Ware
On Wed, Oct 28, 2015 at 11:09 AM, Zachary Ware wrote: >return ''.join(c for c in text if c not in vowels Looking again, I see I typo'd here too. There should of course be a ')' at the end. -- Zach ___ Tutor

Re: [Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Cameron Simpson
On 28Oct2015 14:48, Flynn, Stephen (L & P - IT) wrote: Python 3. I'm iterating through a list and I'd like to know when I'm at the end of the said list, so I can do something different. For example list_of_things = ['some', 'special', 'things'] for

Re: [Tutor] Are there any Python-based GUI builders for tkinter

2015-10-28 Thread Laura Creighton
In a message of Wed, 28 Oct 2015 17:31:35 +, Mark Lawrence writes: >On 28/10/2015 08:39, Laura Creighton wrote: >> In a message of Tue, 27 Oct 2015 15:20:56 -0500, boB Stepp writes: >>> I have a friend at work and he is trying to develop GUI applications >>> in Python, but he does not want to

Re: [Tutor] Are there any Python-based GUI builders for tkinter

2015-10-28 Thread Mark Lawrence
On 28/10/2015 22:32, Laura Creighton wrote: In a message of Wed, 28 Oct 2015 17:31:35 +, Mark Lawrence writes: On 28/10/2015 08:39, Laura Creighton wrote: In a message of Tue, 27 Oct 2015 15:20:56 -0500, boB Stepp writes: I have a friend at work and he is trying to develop GUI

Re: [Tutor] export pandas excel

2015-10-28 Thread Alan Gauld
On 28/10/15 15:26, Lucas Mascia wrote: Hello, Attached is my program, When its a short program(<100 lines say) just include it in the text. Attachments often get rejected by email gateways, especially on corporate firewalls or for mobile devices. = import

Re: [Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Steven D'Aprano
On Wed, Oct 28, 2015 at 02:48:05PM +, Flynn, Stephen (L & P - IT) wrote: > I'm iterating through a list and I'd like to know when I'm at > the end of the said list, so I can do something different. For example > > list_of_things = ['some', 'special', 'things'] > for each_entry in

Re: [Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Steven D'Aprano
Wait, I have another comment... On Wed, Oct 28, 2015 at 02:48:05PM +, Flynn, Stephen (L & P - IT) wrote: > I'm iterating through a list and I'd like to know when I'm at > the end of the said list, so I can do something different. For example [...] > For context, I'm working my way

Re: [Tutor] How to parse large files

2015-10-28 Thread Peter Otten
Danny Yoo wrote: > There are several out there; one that comes standard in Python 3 is > the "dbm" module: > > https://docs.python.org/3.5/library/dbm.html > > Instead of doing: > > diz5 = {} > ... > > we'd do something like this: > > with diz5 = dbm.open('diz5, 'c'): > ... > > And

[Tutor] Demystification of Lambda Functions

2015-10-28 Thread Hunter Jozwiak
Hello, I am not sure exactly why there would be a practical use for a lambda function, other than the fact that you can make one-liner functions that take parameters in to a variable. Or at least that is how things look when they are written. Can I have some demystification? Thanks,

Re: [Tutor] Demystification of Lambda Functions

2015-10-28 Thread Alan Gauld
On 28/10/15 01:04, Hunter Jozwiak wrote: I am not sure exactly why there would be a practical use for a lambda function, other than the fact that you can make one-liner functions that take parameters in to a variable. Or at least that is how things look when they are written. Can I have some

Re: [Tutor] Demystification of Lambda Functions

2015-10-28 Thread Anshu Kumar
Hi, Lambda or anonymous function is core of functional programming which was not in java. With lambda you can pass not just define an anonymous function but can pass them to other functions which really makes life easier. You would like to read http://www.python-course.eu/lambda.php