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

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -