problems with opening files due to file's path

Jerry Hill malaclypse2 at gmail.com
Wed Jun 11 16:42:33 EDT 2008


On Wed, Jun 11, 2008 at 4:16 PM, Alexnb <alexnbryan at gmail.com> wrote:
>
> I posted the underlying code, but I haven't made the GUI code because if I
> can't get the underlying code right it doesn't matter, well in my eyes it
> doesn't but I am probably wrong. But it will look somehting like this:

What you're missing is that all of the problems you're having with
escape characters *only apply to string literals inside your python
source code.*  If you're getting the string from the console, you
don't need to escape or change anything.  If you're getting the string
from a Tk text box, you don't need to escape or change anything.  If
you're getting the string from the filesystem, you don't need to
escape or change anything.

The only place you have to be careful is when you type out a literal
string inside your .py source code.  When you do that, you need to
properly escape backslashes, either by putting them in raw strings, or
by doubling up your backslashes.

If you haven't already, reread the section of the python tutorial
about string literals: http://docs.python.org/tut/node5.html.

-- 
Jerry



More information about the Python-list mailing list