Never miss a guide like this!
Join the DWD mailing list for your weekly dose of knowledge! This mailing list is for doers and thinkers. If you're a curious person, you might find it useful, just as 2,000 other devs do!
How to fix SyntaxError: unterminated triple-quoted string literal in Python
⤳ Python raises “SyntaxError: unterminated triple-quoted string literal” when you use a pair of triple quotes (""" or ''') around a multi-line string literal, but the ending part is missing. Here’s what the error looks like on Python version 3.11: On the other hand, the error ...
How to fix “SyntaxError: ‘return’ outside function” in Python
⤳ Python raises the error “SyntaxError: ‘return’ outside function” once it encounters a return statement outside a function. Here’s what the error looks like: Based on Python’s syntax & semantics, a return statement may only be used in a function to return a value to the caller. However, if – ...
[Solved] SyntaxError: positional argument follows keyword argument
⤳ 🚫 SyntaxError: positional argument follows keyword argument Python raises the “SyntaxError: positional argument follows keyword argument” error if you place one or more keyword arguments (e.g., age=35, name=John) before your positional arguments (e.g., 35, John) in a function call. Based on Python syntax, keyword arguments must follow positional arguments ...
How to fix “SyntaxError: Missing parentheses in call to ‘print'” in Python
⤳ The Python error “SyntaxError: Missing parentheses in call to ‘print’ …” occurs when you use an old-style print statement (e.g., print 'some value') in Python 3. This not so short error message looks like this: As the error explains, from version 3, print() is a ...
[Solved] SyntaxError: invalid non-printable character in Python
⤳ The error “SyntaxError: invalid non-printable character” in Python happens once Python encounters an invalid non-printing character (according to Python’s syntax) in your statements. Non-printing characters might not be visible in your code editor, and you might not notice them until you run the code. Having characters such as ...
[Solved] SyntaxError: invalid character in Python
⤳ The error “SyntaxError: invalid character” occurs once Python encounters an invalid character (according to Python’s syntax) in a statement. You may have invalid characters in a line of code if: Here’s what the error message looks like: This error also indicates which character causes the ...