Help with strings

Hey guys, how is it going?

I have a question, why is that in this excercise: https://www.codecademy.com/courses/learn-python-3/lessons/string-methods/exercises/splitting-strings-iii “spring_storm_text” has the value of = \ before the string?
Is that like a rule when I am going to split strings?

I really appreciate any help. Have a good day you all!

\n is special, its an escaped sequence:

https://en.wikipedia.org/wiki/Escape_sequences_in_C

Escape sequences are used in the programming languages C and C++, and their design was copied in many other languages such as java and c#. An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly.

which is certainly true, its really difficult to represent a new line directly.

1 Like