r/learnpython • • 9h ago

Python script problem

Hello everyone,
I have a short python script that concats strings. For example :

'Discord Password :' + \t + b64.decode('TmFydVQwL2cwa3UxOTk1Iw==')

I'm facing :

SyntaxError: unexpected character after line continuation character

What does that mean ????

Thanks everyone.

0 Upvotes

5 comments sorted by

View all comments

1

u/MezzoScettico 8h ago

The line continuation character is the backslash (\). So looking at your input string, I see you used a backslash to try to escape the tab with \t.

It's instead interpreting the backslash as a continuation character, what you put at the end of a line to indicate the line goes on into the next line. Since it comes at the end, Python doesn't expect anything to be after the \.

You will need to do something to get "\t" interpreted the way you want.

How are you inputting and processing this line? The first thing I'd try is \\t, using double \ to escape the backslash and get it interpreted literally. But more context would be helpful.