We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I wrote this task as below: s='hey (come) go' re.sub('[(].*?[)]', '', s)
The output is: 'hey go'
But if s='hey (come) go (flat)' then the 'go' is deleted too. How can I write code that output should be 'hey go'
The text was updated successfully, but these errors were encountered:
I just tried the second substitution and it does what it ought to do: it returns 'hey go '. go would only be deleted if you omitted the question mark:
'hey go '
go
In [1]: import re In [2]: re.sub('[(].*?[)]', '', 'hey (come) go (flat)') Out[2]: 'hey go ' In [3]: re.sub('[(].*[)]', '', 'hey (come) go (flat)') Out[3]: 'hey '
Sorry, something went wrong.
Yes, you are right :)
No branches or pull requests
I wrote this task as below:
s='hey (come) go'
re.sub('[(].*?[)]', '', s)
The output is: 'hey go'
But if s='hey (come) go (flat)' then the 'go' is deleted too.
How can I write code that output should be 'hey go'
The text was updated successfully, but these errors were encountered: