Can not find a file in CMD model python when everything is OK in IDLE

Fredrik Lundh fredrik at pythonware.com
Sat Mar 11 05:24:57 EST 2006


"Sullivan WxPyQtKinter" wrote:

> I use python in Windows XP platform. I find that if I write a .py file
> in a directory, such as windows desktop, in which a file named
> 'ticket.txt' is located:
>
> f=open("\ticket.txt")
> print f.read()

"\t" is a tab character:

    >>> print '\ticket.txt'
            icket.txt

try opening r"\ticket.txt" or "/ticket.txt" instead.

</F>






More information about the Python-list mailing list