Message230994
| Author |
crkirkwood |
| Recipients |
crkirkwood, docs@python |
| Date |
2014年11月11日.01:26:03 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1415669163.97.0.11938367664.issue22843@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Documentation says:
> Match objects always have a boolean value of True. Since match() and
> search() return None when there is no match, you can test whether
> there was a match with a simple if statement:
>
> match = re.search(pattern, string)
> if match:
> process(match)
What happens:
blah = <_sre.SRE_Match object; span=(0, 28), match='<BR>Nov. 10, 08:16:09 PM EST'>
if blah == True:
print("True")
if blah:
print('blah True')
blah True
///
Blah is not True
One suggestion: instead, the passage above should say "evaluates true in a boolean context". |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年11月11日 01:26:04 | crkirkwood | set | recipients:
+ crkirkwood, docs@python |
| 2014年11月11日 01:26:03 | crkirkwood | set | messageid: <1415669163.97.0.11938367664.issue22843@psf.upfronthosting.co.za> |
| 2014年11月11日 01:26:03 | crkirkwood | link | issue22843 messages |
| 2014年11月11日 01:26:03 | crkirkwood | create |
|