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

11-regex- ex2 peek problem in VS Code #233

Open
Atomx3 opened this issue Mar 9, 2020 · 1 comment
Open

11-regex- ex2 peek problem in VS Code #233

Atomx3 opened this issue Mar 9, 2020 · 1 comment

Comments

@Atomx3
Copy link

Atomx3 commented Mar 9, 2020

Dear Chuck,

I am doing exercise 2 on
https://www.py4e.com/html3/11-regex

I found my VS Code peek problem noticed that:
Anomalous backslash in string: '\s'. String constant might be missing an r prefix.pylint(anomalous-backslash-in-string)

but it's no problem to run my code.

import re
hand = open('mbox-short.txt')
for line in hand:
    line = line.rstrip()
    if re.search('^N.*\s.*: [0-9.]+', line):
        print(line)

then I add 'r' before '^N', no peek problem error anymore, what's the problem I should solve ?

@BenSYZ
Copy link

BenSYZ commented Jul 23, 2020

r in r'^N.*\s.*: [0-9.]+' tells Python use the following string directly, rather translate the \s first.

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

2 participants