[Tutor] How to programmatically EDIT a python file using an editorof my choice ?

Sander Sweers sander.sweers at gmail.com
Sun Apr 12 20:06:51 CEST 2009


2009/4/12 Dominique <mydomdom at gmail.com>:
> With r before the path of the software, it works perfectly.
> subprocess.Popen([r"C:\Program Files\Editra\Editra.exe", filename])
> I saw that once but I don't remember and cannot find the reason for the use of r.

The r means the string is a raw string.

> I'll try not to forget to test with and without r in case a file access doesn't
> work.

The real issue is what Alan pointed out. The backlash is an escape
character and if you want to use it in a string should be escaped by a
backlash.Using a raw string will give the same result as 'C:\\Program
Files\\Editra\\Editra.exe'

Greets
Sander


More information about the Tutor mailing list