I have string looking like this:
'Toy Story..(II) (1995)'
I want to split the line into two parts like this:
['Toy Story..(II)','1995']
How can I do it? Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This code will get you started:
Other than that, you can use
r'\s*[(]\d{4}[)]\s*$'to match a four-digit number in parentheses at the end of the string. If you find it, you can chop it off: