[Tutor] accessing an image with pygame.image.load()

Jerry Hill malaclypse2 at gmail.com
Tue Nov 4 03:37:48 CET 2008


On Mon, Nov 3, 2008 at 7:05 PM, bob gailer <bgailer at gmail.com> wrote:
> Christopher Spears wrote:
>> self.image =
>> pygame.image.load("C:Users\Chris\Documents\python\assignment07\chris_graphics\spaceship.gif")
>>
>
> Since \ is used to "escape" certain characters it is advisable to either use
> \\ or preface the string with r.

Beyond what Bob says about being careful of the escape character ('\')
and the need to either double it up in a string literal or use a raw
string, are you sure that path is right?  Usually a drive letter is
followed by a backslash in windows.  That is, "C:\Users\Chris" rather
than "C:Users\Chris".

-- 
Jerry


More information about the Tutor mailing list