Image.open( "C:\test.jpg") is this wrong ?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Aug 28 06:23:35 CEST 2007


En Mon, 27 Aug 2007 11:48:46 -0300, Carnell, James E  
<jecarnell at saintfrancis.com> escribi�:

>> Image.open("C:\test.jpg")  # this is what I have right now. And it
>> can't find the file or directory. The file is there (it is everywhere
>> on my computer now!!!)

Use "C:\\test.jpg" or r"C:\test.jpg" or "C:/test.jpg" instead.
\t is interpreted as a tab character

> I found some code where they apply the file path to a variable in single
> quotes. Is that how it is done. Also I thought single quotes were for
> characters not strings.

a = 'This is a string'
b = "This is a string too"
c = """This is a
very long
string, spanning
several lines"""
d = '''This is
a multiline
string too'''
e = "e"
f = 'f'

You can read the relevant Tutorial section here  
<http://docs.python.org/tut/node5.html#SECTION005120000000000000000>

-- 
Gabriel Genellina




More information about the Python-list mailing list