Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python File I/O

Name: Anonymous 2010-10-04 10:21

I have a words.txt file that looks like:

the
of
and
to


And a python script that looks like:


import random
y = ""
z = 0

openfile = open('words.txt', 'r')
contents = openfile.read()
openfile.close()
print contents

for i in range (len(contents)):
    x = random.choice(contents)
    if x == """
""":
        y == """
"""
    else:
        y = ""
        print x
        z = z + 1
        while x != y:
            y = raw_input('>>>')
print z

I want the output to be the full words, but it outputs just letter like:


o
>>>o
o
>>>o
a
>>>a
n
>>>n
t
>>>t
e
>>>e
h
>>>h


Any help?

Name: Anonymous 2010-10-04 13:11

>>10,11
Fuck off, ``faggot''.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List