[Tutor] creating files with python and a thanks

alan.gauld@bt.com alan.gauld@bt.com
Mon, 18 Feb 2002 10:23:17 -0000


> > (I used the r in front of the quotes, so that it will interpret the
> > string as a "raw" string, and not assume the \t on \temp 

Just as a reminder you can always use forward slashes on DOS paths too, 
which avoids the need for the r flag...

> I use a unix-style filesystem, so I wouldn't have the same problem as 
> above (it would be './temp/myfile.mbg', 

Which works in DOS land too.

> that /t has no special meaning

No, it's the \ character that means escape

> Do you try to always use the 'r' option -except- when you want 
> expansion, or is the general practice to only use it when you 
> -need- it to prevent a metacharacter like \t from being expanded?

The python idiom is the latter although I do see a lot of people 
starting to use it as a default - which is a bad thing IMHO...

Alan g.