Raw Unicode docstring

Steve Holden steve at holdenweb.com
Wed Nov 17 19:07:42 CET 2010


On 11/17/2010 11:32 AM, RJB wrote:
> On Nov 16, 1:56 pm, Boštjan Mejak <bostjan.me... at gmail.com> wrote:
>> Hello,
>>
>> how does one write a raw unicode docstring? If I have backslashes in
>> the docstring, I must tuck an 'r' in front of it, like this:
>> r"""This is a raw docstring."""
>>
>> If I have foreign letters in the docstring, I must tuck a 'u' in front
>> of it, like this:
>> u"""This is a Unicode docstring."""
>>
>> What if I have foreign characters *and* backslashes in my docstring?
>> How to write the docstring then?
>> ru"""My raw unicode docstring."""
>> or
>> ur"""My unicode docstring."""
>>
>> Please answer my question, although it may sound like a noobish one. Thanks.
> 
> Check out
>   http://cse.csusb.edu/dick/samples/python.syntax.html#stringprefix
> which lists alternate string prefixes.
> 
> Does any bodyy know if "ur" and "UR" mean the same thing?

Yes, they do.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/




More information about the Python-list mailing list