[Tutor] Implementing sets of user-defined objects

2010-07-23 Thread mhw
Dear Tutors, I am tring to deal with some repeated data, and hence repeated objects (I construct objects from the data). I had hoped to use a set to uniquify the objects. However, I am having problems with defining uniqueness. I have googled/ looked at the Python docs/ read DITP and Alan's web

Re: [Tutor] Implementing sets of user-defined objects

2010-07-23 Thread Steven D'Aprano
On Fri, 23 Jul 2010 09:22:55 pm m...@doctors.net.uk wrote: > Dear Tutors, > > I am tring to deal with some repeated data, and hence repeated > objects (I construct objects from the data). > > I had hoped to use a set to uniquify the objects. However, I am > having problems with defining uniqueness.

[Tutor] position of an element in list:

2010-07-23 Thread Vineeth Rakesh
Hello all, How to return the position of a character in a string. Say I have str1 = "welcome to the world" if i want to return the position of the first occurrence of "o" how to do it? Thanks Vin ___ Tutor maillist - Tutor@python.org To unsubscribe or

Re: [Tutor] position of an element in list:

2010-07-23 Thread Luke Paireepinart
You can do it with any iterator Astr.index('o') I'm not sure what happens when there are multiple instances of 'o' though, check the docs on index. Sent from my iPhone On Jul 23, 2010, at 8:22 AM, Vineeth Rakesh wrote: > Hello all, > > How to return the position of a character in a strin

Re: [Tutor] how i can change two lists into one directory

2010-07-23 Thread steve
On 07/23/2010 08:01 AM, Robert wrote: looks like this guy figured out how to send email in a loop User-Agent: Mutt/1.5.20 (2009-06-14) Or just discovered Mutt but hasn't figured out the keybindings yet. -- random spiel: http://lonetwin.net/ what i'm stumbling into: http://lonetwin.stumbleupo

Re: [Tutor] position of an element in list:

2010-07-23 Thread Christian Witts
On 23/07/2010 15:22, Vineeth Rakesh wrote: Hello all, How to return the position of a character in a string. Say I have str1 = "welcome to the world" if i want to return the position of the first occurrence of "o" how to do it? Thanks Vin ___ Tut

Re: [Tutor] position of an element in list:

2010-07-23 Thread Steven D'Aprano
On Fri, 23 Jul 2010 11:22:54 pm Vineeth Rakesh wrote: > Hello all, > > How to return the position of a character in a string. Say I have > str1 = "welcome to the world" if i want to return the position of the > first occurrence of "o" how to do it? str1.find("o") will return the index of the first

Re: [Tutor] position of an element in list:

2010-07-23 Thread Mark Lawrence
On 23/07/2010 16:43, Steven D'Aprano wrote: On Fri, 23 Jul 2010 11:22:54 pm Vineeth Rakesh wrote: Hello all, How to return the position of a character in a string. Say I have str1 = "welcome to the world" if i want to return the position of the first occurrence of "o" how to do it? str1.find(

Re: [Tutor] position of an element in list:

2010-07-23 Thread Alan Gauld
"Vineeth Rakesh" wrote How to return the position of a character in a string. Say I have str1 = "welcome to the world" if i want to return the position of the first occurrence of "o" how to do it? Others have answered but don't forget Python's help() facility. help(str) Would have proba

Re: [Tutor] Difficulty Understanding Example Code for Blender Script

2010-07-23 Thread Andrew Martin
Oh ok. So orientation is an optional parameter. That makes sense. Alright well thanks for the help And yeah next time it would probably be better to try the blender forums. thanks though On Thu, Jul 22, 2010 at 3:06 AM, David Hutto wrote: > On Thu, Jul 22, 2010 at 2:47 AM, Marc Tompkins > wrot

[Tutor] decorators

2010-07-23 Thread Mary Morris
I'm trying to compile a list of decorators from the source code at my office. I did this by doing a candidate_line.find("@") because all of our decorators start with the @ symbol. The problem I'm having is that the email addresses that are included in the comments are getting included in the lis

Re: [Tutor] decorators

2010-07-23 Thread शंतनू
On Friday 23 July 2010 11:53 PM, Mary Morris wrote: I'm trying to compile a list of decorators from the source code at my office. I did this by doing a candidate_line.find("@") How about using something like candidate_line.strip.startswith('@') and calculate_line.find('.') == -1 There are f

Re: [Tutor] decorators

2010-07-23 Thread Steven D'Aprano
On Sat, 24 Jul 2010 04:23:41 am Mary Morris wrote: > I'm trying to compile a list of decorators from the source code at my > office. > I did this by doing a > > candidate_line.find("@") > > because all of our decorators start with the @ symbol. The problem > I'm having is that the email addresses

Re: [Tutor] decorators

2010-07-23 Thread Peter Otten
Mary Morris wrote: > I'm trying to compile a list of decorators from the source code at my > office. > I did this by doing a > > candidate_line.find("@") > > because all of our decorators start with the @ symbol. The problem I'm > having is that the email addresses that are included in the comm

[Tutor] can i run the last saved input again

2010-07-23 Thread ANKUR AGGARWAL
hey this is a crazy question but i want to know it.. suppose i have this code a=raw_input("enter the string :") print a then i type python prog.py output: enter the string:hello hello now i want to ask is there's any way that python remembers the input i gave it to last time and it just gi

Re: [Tutor] can i run the last saved input again

2010-07-23 Thread vishwajeet singh
On Sat, Jul 24, 2010 at 11:16 AM, ANKUR AGGARWAL wrote: > hey this is a crazy question but i want to know it.. > suppose i have this code > > a=raw_input("enter the string :") > print a > > then i type python prog.py > > output: > enter the string:hello > hello > > > now i want to ask is there

Re: [Tutor] can i run the last saved input again

2010-07-23 Thread Steven D'Aprano
On Sat, 24 Jul 2010 03:46:15 pm ANKUR AGGARWAL wrote: [...] > now i want to ask is there's any way that python remembers the input > i gave it to last time and it just give me the output when i again > run python prog.py?? i mean i dont need to give input again. I > just need to give input only

Re: [Tutor] can i run the last saved input again

2010-07-23 Thread Shashwat Anand
On Sat, Jul 24, 2010 at 11:16 AM, ANKUR AGGARWAL wrote: > hey this is a crazy question but i want to know it.. > suppose i have this code > > a=raw_input("enter the string :") > print a > > then i type python prog.py > > output: > enter the string:hello > hello > > > now i want to ask is there