faqts : Computers : Programming : Languages : Python : Language and Syntax

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 8 people (75%) answered Yes
Recently 3 of 4 people (75%) answered Yes

Entry

How do I write a raw string (r'...') that ends with a backslash?

May 18th, 2000 17:53
unknown unknown, Beat Bolli, Moshe Zadka


r'this ends with a ' '\\'

A pure raw string cannot end with an odd number of backslashes. The 
above, using the fact that consecutive string literals are concatenated 
at runtime, is the standard workaround.