Problem while doing a cat on a tabbed file with pexpect

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Jan 15 18:04:06 EST 2012


On Sun, 15 Jan 2012 09:51:44 -0800, Saqib Ali wrote:

> I am using Solaris 10, python 2.6.2, pexpect 2.4
> 
> I create a file called me.txt which contains the letters "A", "B", "C"
> on the same line separated by tabs.
[...]
> Now, clearly the file contains tabs.

That is not clear at all. How do you know it contains tabs? How was the 
file created in the first place?

Try this:

text = open('me.txt', 'r').read()
print '\t' in text

My guess is that it will print False and that the file does not contain 
tabs. Check your editor used to create the file.



-- 
Steven



More information about the Python-list mailing list