Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.
It's just a bunch of yes's and no's in a straight text file in Windows 7. However, I've tried reading the file several ways, and I get unexpected results. When I do this:
YES NO YES YES NO ...
file1 = list(open(sys.argv))
and when I do:
['\xff\xfeY\x00E\x00S\x00\r\x00\n', '\x00Y\x00E\x00S\x00\r\x00\n', '\x00N\x00O\x00\r\x00\n', '\x00N\x00O\x00\r\x00\n', ' \x00N\x00O\x00\r\x00\n', '\x00N\x00O\x00\r\x00\n', '\x00Y\x00E\x00S\x00\r\x00\n', '\x00Y\x00E\x00S\x00\r\x00\n', '\x00Y\ .......]
f1 = open(sys.argv, "r") lines1 = f1.readlines() for i in lines1: print i.strip()
What is going on here and how do I read this as I expect it to be in the file?
■Y E S Y E S N O N O N O N O Y E S Y E S Y E S N O Y E S Y E S
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
11 Experts available now in Live!