[Tutor] Tutor Digest, Vol 128, Issue 22

Alan Gauld alan.gauld at btinternet.com
Fri Oct 10 11:55:35 CEST 2014


On 10/10/14 09:32, Henry wrote:

> I am new to programming.

Welcome to tutor. Please set a meaningful subject line in your messages.
It helps people doing a search and will attract interested readers
so you get more chance of help.

> After I created two text files(the text file is most consist of
> numbers), its class is "<class '_io.TextIOWrapper'>", how can I compare
> this class with two text files?

I'm not really sure what you mean.

How did you "create" the text files? On the hard disk using
a text editor? Or by opening the files in python using open()?
The _io.TextWrapper is just the class that python uses to model
text files, you should hardly ever need to know anything about it.
You should never need to be comparing it to actual files - I'm
not even sure what that would mean...

You can compare two text file objects, but that's rarely meaningful.
Or you can compare the contents of two text files, which is more
common. For the latter there is the difflib module to help.

> Please give me a hint which area I should look under? Set? List?

You need to explain in more detail what you are trying to do.
It might be good to give short example data, say a couple of
lines from each file and what you expect the output to look like.

Also any code you have written, because it shows us the way
you are tackling the problem.

Finally always include the fill text of any errors, plus a
note of the python version and OS you are using too.

> On Fri, Oct 10, 2014 at 12:04 PM, <tutor-request at python.org
> <mailto:tutor-request at python.org>> wrote:
>
>     Send Tutor mailing list submissions to
>     tutor at python.org <mailto:tutor at python.org>

And do not send the full text of the digest. We've all seen
the messages already and some people pay by the byte so it
costs them money.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list