Why does the strip() method remove break line?

I’ve noticed that .strip() when left with no arguments, removes whitespace, but also “\n” when seen. Why? Does it also remove other escape characters? what about if we had .strip(" ")? I know this behaves slightly differently regarding consecutive whitespace, but would this still remove escape characters or \n?

The docs aren’t entirely clear, they mention it strips whitespace from the ends but exactly what’s considered whitespace might be a little tricky to guess (tabs, newlines vertical tabs and such for sure). I’m sure there’s a proper definition somewhere but it seems pretty greedy (might need to find the proper string escape details for more of them)-

a_str = "\n\f\r\t\n hi \x1e \u2028 \v" print(f"--{a_str}--") print() print(f"--{a_str.strip()}--")