Terry Reedy a écrit :
(snip)
I believe
wordlist = open('words.txt','r').read().split('\n')
should give you the list in Python.
Or simply:
wordlist = open('words.txt').readlines()
In any case,
wordlist = ['Apple','balcony', 'cartridge',
'damned', 'paper', 'bold', 'typewriter']
for i, word in enumerate(wordlist):
if word[0] == 'b':
While this is perfectly legal, I'd rather use word.startswith('b') here.
But don't ask me why !-)
print(wordlist[i+1])
Hmmm... Guess what will happen if wordlist == ['Apple', 'balcony'] ?
--
http://mail.python.org/mailman/listinfo/python-list