The file me.txt does indeed contain tabs. I created it with vi. >>> text = open("me.txt", "r").read() >>> print "\t" in text True
% od -c me.txt 0000000 A \t B \t C \n 0000006 % ls -al me.txt -rw-r--r-- 1 myUser myGroup 6 Jan 15 12:42 me.txt On Jan 15, 6:40 pm, Cameron Simpson <c...@zip.com.au> wrote: > On 15Jan2012 23:04, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> > wrote: > | 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. > > I was going to post an alternative theory but on more thought I think > Steven is right here. > > What does: > > od -c me.txt > > show you? TABs or multiple spaces? > > What does: > > ls -ld me.txt > > tell you about the file size? Is it 6 bytes long (three letters, two > TABs, one newline)? > > Steven hasn't been explicit about it, but some editors will write spaces when > you type a TAB. I have configured mine to do so - it makes indentation more > reliable for others. If I really need a TAB character I have a special > finger contortion to get one, but the actual need is rare. > > So first check that the file really does contain TABs. > > Cheers, > -- > Cameron Simpson <c...@zip.com.au> DoD#743http://www.cskk.ezoshosting.com/cs/ > > Yes Officer, yes Officer, I will Officer. Thank you. -- http://mail.python.org/mailman/listinfo/python-list