How can I extract the date from a string like “monkey 2010-07-10 love banana”? Thanks!
Share
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.
If the date is given in a fixed form, you can simply use a regular expression to extract the date and “datetime.datetime.strptime” to parse the date:
Otherwise, if the date is given in an arbitrary form, you can’t extract it easily.