Question #6684
Submitted by Answiki
on 09/16/2022 at 08:35:53 PM UTC
In Python, how to extract a text between parentheses in a string?
Merged questions
Answer
Submitted by Answiki
on 09/16/2022 at 08:35:30 PM UTC
The following Python code returns the text located between the first pair of parentheses:
s="example (the)"
text = s[ s.find( '(' )+1 : s.find( ')' ) ]
# text = 'the'
Question by Answiki 09/16/2022 at 08:35:53 PM
In Python, how to extract a text between parentheses in a string?
Answer by Answiki on 09/16/2022 at 08:35:30 PM
The following Python code returns the text located between the first pair of parentheses:
s="example (the)"
text = s[ s.find( '(' )+1 : s.find( ')' ) ]
# text = 'the'
Answer by Answiki on 09/16/2022 at 08:35:04 PM
The following Python code returns the text located between the first parenthesis:
s="example (the)"
text = s[ s.find( '(' )+1 : s.find( ')' ) ]
# text = 'the'
Answer by Answiki on 09/16/2022 at 08:34:05 PM
The following Python code returns the text located between parenthesis:
s="example (the)"
text = s[ s.find( '(' )+1 : s.find( ')' ) ]
# text = 'the'
Question by Answiki 09/16/2022 at 08:32:37 PM
In Python, how to extract a text between parenthesis in a string? replaced by #6684.
# | ID | Query | URL | Count |
---|
Icons proudly provided by Friconix.