Search code examples
pythonsyntaxtoken

Bad Token on line 1 with print statement


I couldn't find anything online that would help so I'm asking here. I want to format my print statement like this:

print("
1.)It really do be like that sometimes
2.)ok
3.)uhhhhhhhh
")

When I try to run it however, it says "SyntaxError: bad token on line 1 in main.py" and I don't know what I did wrong. Any advice?


Solution

  • You can't have linebreaks in a string literal like that. Try replacing your code with this:

    print("\n1.)It really do be like that sometimes\n2.)ok\n3.)uhhhhhhhh\n")