Is there a method that returns a character at a specified index?
Cameron Laird
claird at lairds.com
Sun Oct 26 21:40:42 EST 2003
In article <bnhusm$114ioa$1 at ID-198839.news.uni-berlin.de>,
Michael Loomington <mloomington at yahoo.ca> wrote:
>Couldn't find anything here
>http://www.python.org/doc/2.3.2/lib/string-methods.html
>
>I need to cycle through lines in a file that contain words and compare it to
>a string thats given, call it SSS to see if the words in the file can be
>written from SSS. I am planning to grab each letter from the word one at a
>time and removing it from SSS and if the letter doesn't exist then I will go
>on to the next word. That's why I need a method that returns a letter at
>each index. Maybe there an easier way of doing this.
>
>
I don't understand your description.
I'm certain there's an easier way.
My guess is that this is an example of what you think you want:
Python 2.3+ (#2, Aug 10 2003, 11:33:47)
[GCC 3.3.1 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> alphabet = "abcdefghijklmnopqrstuvwxyz"
>>> alphabet[3]
'd'
>>> alphabet[14]
'o'
>>>
--
Cameron Laird <claird at phaseit.net>
Business: http://www.Phaseit.net
More information about the Python-list
mailing list