S
S
semen79072018-02-26 16:29:13
Python
semen7907, 2018-02-26 16:29:13

How to remove text in brackets?

Please tell me how to remove the text that is in brackets ( ), example:

Python (MFA: [ˈpʌɪθ(ə)n]; the name python is common in Russian) is a high-level programming language.....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pcdesign, 2018-02-26
@semen7907

>>> a = """Python (МФА: [ˈpʌɪθ(ə)n]; в русском языке распространено название пито́н) — высокоуровневый язык программирования....."""
>>> import re
>>> print(re.sub(r'\(.+?\)\s', '', a)) 
Python  — высокоуровневый язык программирования.....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question