What does (A ``quote'' is the character used to open the string, i.e. either ' or ".) mean?

MRAB python at mrabarnett.plus.com
Thu Jul 10 18:48:25 CEST 2014


On 2014-07-10 16:23, fl wrote:
> On Thursday, July 10, 2014 10:14:14 AM UTC-4, Chris "Kwpolska" Warrick wrote:
>> >
>>
>>
>> Please don't learn from this link.  It's from 2001.  You should learn
>>
>> from modern documentation: https://docs.python.org/ (if not running
>>
>> 3.4.x, change the version in the top)
>>
>>
>>
>> You also should not read the language reference, it's meant for people
>>
>> who really care about what's under the hood.  The official tutorial is
>>
>> better for learning: https://docs.python.org/3/tutorial/index.html
>>
>>
> Thank you for your advice. My OP was originated from a question from this link:
> https://wiki.python.org/moin/RegularExpression
>
> It has several useful examples. Several of them are not clear to me. Please
> explain it to me.
>
> Is '\A' the same with '^'?
> Is '\Z' the same with '$'?
>

\A matches at the start of the string.

\Z matches at the end of the string.

Normally, ^ matches at the start of the string, but if the re.MULTILINE
flag is turned on, it matches at the start of a line.

Normally, $ matches at the end of the string, or just before the final 
'\n' if that '\n' is the final character, but if the re.MULTILINE flag
is turned on, it matches at the end of a line.




More information about the Python-list mailing list