In <2f08e970-1334-4e7f-ba84-14869708a...@googlegroups.com> Leonardo Petry <leonardo.petry...@gmail.com> writes:
> fin = open('wordplay.txt'); > user_input = raw_input('Enter some characters: ') > count = 0 > for line in fin: > word = line.strip() > if(avoids(word, user_input)): > count += 1; > This is just too convenient. > Basically my question is: Why is python not treating the contents of > wordplay.txt as one long string and looping each character? > Any comment is greatly appreciate. Thanks Your code is not treating the contents of wordplay.txt as one long string because 'for line in fin:' tells it to read line-by-line. If you want to read the entire contents, use the read() method: file_content = fin.read() -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.com watch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list