Replies: 1 comment
-
Hint: the question is about replacing a string with another - you don't need a regex for this |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have a problem with this "Next, use the replace() method to replace instances of the string stored under the variable copyright with an empty string in the string variable text. Assign the result to text, that is, update the variable"
My attempt is:
import re
copyright = re.compile(r' ')
text = """Reproduced with permission of the copyright owner. Further reproduction prohibited without permission."""
text = copyright.sub(repl = '', string = text)
The failed error says: Failed 'ReplaceValue: test_replace_value'
'str' object has no attribute 'sub'
Could you please tell what I am missing?
Beta Was this translation helpful? Give feedback.
All reactions