When reading files in Python (on mac) the printed out text is incorrect -


i trying out simple command, open , read file. have created text edit file , saved test.txt (this file has irrelevant text on it). when run program there no errors , print commands executed, except wrong information printed.this code:

f = open("test2.docx","r") line1 = f.readline() line2 = f.readline() line3 = f.readline() print line1, line2, line3 

this written in text file:

cof180;10;40 cof181;10;90 phf110;15;73 phf210;15;81 

this printed out program:

{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 {\fonttbl\f0\fswiss\fcharset0 helvetica;} {\colortbl;\red255\green255\blue255;} 

this seems sort of hidden code text itself? please have no idea why happening. how make print actual text file?

if using textedit, menu bar select format -> make plain text.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -