Yes, it's possible and the use cases are largely the same. There's one caveat, though: you must define such strings using ur'string' and not ru'string'. Remember, a raw string just affects how it is interpreted, whereas a Unicode string generates an entirely new data type.
Strings promote to the "widest" value. For example, Unicode + Unicode is Unicode. At the same time, Unicode + String is Unicode.
The exception would have been handled in the default fashion. Our application would terminate and Python would print a back trace.
Essentially, in places where you're printing the same string repeatedly, but with different values in constant places. It's also useful when creating longer strings such as e-mail message content; you can save your template in an external file and access it via Python's file IO mechanisms.
If you have an existing dictionary, you can pass it to a string's format method by prepending it with two asterisks.
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits", or "license" for more information. >>> d = {'a': 1, 'b': 2} >>> '{a}/{b} = Half'.format(**d) '1/2 = Half' >>>
The answer in this case is a string representation of 12. The + operator, when applied to strings, results in a concatenation.