What is 're.M'?
breamoreboy at yahoo.co.uk
Mon Jul 7 16:25:29 CEST 2014
On 07/07/2014 15:08, rxjwg98 at gmail.com wrote:
> I learn this short Python code from:
> but I still do not decipher the meaning in its line, even after read its command
> It says that:
> Makes $ match the end of a line (not just the end of the string) and makes ^
> match the start of any line (not just the start of the string).
> More specific, what does 're.M' means?
> I have tried several other modification to the searchObj line, without clue yet.
> Could you explain re.M and the following two searchObj mechanisms?
> import re
> line = "Cats are smarter than dogs";
> searchObj = re.search( r'(.*) (.*?) .*', line, re.M|re.I)
> # searchObj = re.search( r'(.*) (.*?) .*', line, re.M|re.I)
> if searchObj:
> print "searchObj.group() : ", searchObj.group()
> print "searchObj.group(1) : ", searchObj.group(1)
> print "searchObj.group(2) : ", searchObj.group(2)
> print "Nothing found!!"
The answer is on the first link that I sent you yesterday afternoon,
that's 06/07/2014 15:25 BST. Was the email not delivered or did you not
bother to read it?
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
This email is free from viruses and malware because avast! Antivirus protection is active.
More information about the Python-list