Re: Changer le path pour l'accès aux modules

Chris Angelico rosuav at gmail.com
Fri Sep 12 15:34:47 CEST 2014


2014-09-12 23:19 GMT+10:00 ast <nomail at invalid.com>:
> Tout d'abord à quoi correspond le ' ' vide au tout début ?
> Pourquoi y a t'il deux backslashs \\ entre les répertoires ?
> (sous windows normalement c'est un seul)

Hi! I'm afraid my French isn't very good, but Google Translate
suggests you're asking about why there are two backslashes rather than
one. I hope your English is good enough to comprehend my response;
otherwise, you may find more help on a dedicated French language forum
- sorry!

The backslash has special meaning to Python strings. When they're
displayed in a list, like that, strings get special characters marked.
For instance, quotes and apostrophes will have backslashes in front of
them. That means that the backslash has to be marked too - so it'll be
shown with a second backslash.

Try this instead:

for path in sys.path: print(path)

That'll show them with only one backslash, one per line.

ChrisA



More information about the Python-list mailing list