Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(bug?) error for raw strings that contain \ at the end #299

Closed
victorel-petrovich opened this issue Jul 31, 2023 · 1 comment
Closed

(bug?) error for raw strings that contain \ at the end #299

victorel-petrovich opened this issue Jul 31, 2023 · 1 comment

Comments

@victorel-petrovich
Copy link

victorel-petrovich commented Jul 31, 2023

This pythonscript:

s = r"this is  a string using a \"
console.write(s)

Produces error:

  File "...\npp.8.5.4.portable\plugins\Config\PythonScript\scripts\test.py", line 3
    s = r"this is  a string using a \"
                                     ^
SyntaxError: EOL while scanning string literal

Same error with print(s) though.

Also same error when just define the line s = r"this is a string using a \" at the console command-line (and click Run)

@victorel-petrovich victorel-petrovich changed the title (little bug) console.write produces error for raw strings that contain \ at the end (bug?) error for raw strings that contain \ at the end Jul 31, 2023
@victorel-petrovich
Copy link
Author

victorel-petrovich commented Jul 31, 2023

Ah, no, it's a documented thing with raw strings in python:

a backslash, \, is taken as meaning "just a backslash" (except when it comes right before a quote that would otherwise terminate the literal)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant