I have this code and its not working
import re
mystring = "This is my test the string to match the stuff"
p = re.compile(" the ")
Now I want to able to put the first match found in var1 and second match in var2
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.
You mean something like this?
In case the number of matches returned are more than 2, then you’ve slice the list first.
On python 3.x you can take the advantage of the
*to grab the rest of the elements in a list: