Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote >> Thanks guys it was really helpful i m just a beginner in >> python >> start to program since two days back. So finding little difficulty >> with >> some concepts. >> > > Don't worry, I'm a 20 days "old timer". ;c) And I've been using Python for

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Ricardo Aráoz
Varsha Purohit wrote: > > Thanks guys it was really helpful i m just a beginner in python > start to program since two days back. So finding little difficulty with > some concepts. > Don't worry, I'm a 20 days "old timer". ;c) ___ Tutor maillist

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote >>From Python 2.5 documentation : > > index( sub[, start[, end]]) > Like find(), but raise ValueError when the substring is not found. As opposed to find() which returns -1 when the string is not found. That means you can use try/except with index but mu

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Varsha Purohit
Thanks guys it was really helpful i m just a beginner in python start to program since two days back. So finding little difficulty with some concepts. On 9/2/07, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > > Varsha Purohit wrote: > > Hello, > > i have again very basic question in python stri

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Ricardo Aráoz
Varsha Purohit wrote: > Hello, > i have again very basic question in python string management. > > I am not able to understand how find and index works and what do they > actually return. > line = "this is varsha" print line.find("is") > 2 print line.rfind("is") > 5 print li

[Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Varsha Purohit
Hello, i have again very basic question in python string management. I am not able to understand how find and index works and what do they actually return. >>> line = "this is varsha" >>> print line.find("is") 2 >>> print line.rfind("is") 5 >>> print line.rfind("varsha") 8 >>> print line.index(