The answer above needs to be slightly modified. Regular Chinese square brackets [] themselves have grammatical meaning, so they need to be escaped. Just change it to this.
pythonimport re
str1 = re.sub(r'\[.*\]', '', "universe ['juːnɪvɜːs]")
The official description of the python re module is as follows:
https://docs.python.org/2/library/re.html
Sometimes you forget to check the regular rules, they are quite detailed.
The answer above needs to be slightly modified. Regular Chinese square brackets
[
]
themselves have grammatical meaning, so they need to be escaped. Just change it to this.The official description of the python re module is as follows:
https://docs.python.org/2/library/re.html
Sometimes you forget to check the regular rules, they are quite detailed.
Segmentfaults seems to automatically [escape to [, which forces me to use code blocks.