+ 1

Raw string in Py

What does raw string actually mean and what's the main function of this ?

30th Jun 2018, 7:04 AM
Hồng Vĩ
Hồng Vĩ - avatar
1 Antwort
+ 2
There's not really any "raw string"; there are raw string literals, which are exactly the string literals marked by an 'r' before the opening quote. A "raw string literal" is a slightly different syntax for a string literal, in which a backslash, \, is taken as meaning "just a backslash" (except when it comes right before a quote that would otherwise terminate the literal) -- no "escape sequences" to represent newlines, tabs, backspaces, form-feeds, and so on. In normal string literals, each backslash must be doubled up to avoid being taken as the start of an escape sequence.
30th Jun 2018, 12:07 PM
Agent
Agent - avatar