i have a problem with the Hangman Game from the second problem set. When I run it without changing anything it gives me this error:
inFile = open(WORDLIST_FILENAME, 'r', 0)
ValueError: can't have unbuffered text I/O
I am using Eclipse as development environment
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
inFile = open(WORDLIST_FILENAME, 'r')
The ", 0" isn't needed and apparently in different OS's and/or Python versions can cause problems.
Thanks for your help, I really appreciate it!!
It worked, but now I get another error:
wordlist = string.split(line)
AttributeError: 'module' object has no attribute 'split'
Could you help me again?
Thanks a lot!
strings are treated as objects of type string. The method split() should be called on an instance of a string. string is a Python module. The code should be something like:
>>> foo = "Hello World"
>>> foo.split( ' ' )
The split() method takes a string to use to split the parent string on ( in this case, space ).
Not the answer you are looking for? Search for more explanations.
I am using Python 3.5 and work in LiClipse. Apparently, there were some changes specific either to OS or to Python version which require small changes in syntax. So in your case try wordlist = str.split(line). Should work.