From 84f0d19f3cfd1266be2885bd0c65286c7ec82d23 Mon Sep 17 00:00:00 2001 From: Nasy Date: Fri, 25 Jun 2021 02:50:46 -0400 Subject: [PATCH] Use bool instead of True if else False. * source/c01/c01_31.md * source/c01/c01_31.rst --- source/c01/c01_31.md | 4 ++-- source/c01/c01_31.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/c01/c01_31.md b/source/c01/c01_31.md index 1864dab..e5e8abd 100644 --- a/source/c01/c01_31.md +++ b/source/c01/c01_31.md @@ -61,8 +61,8 @@ hello world >>> msg='hello----world' >>> msg.split('-') ['hello', '', '', '', 'world'] ->>> ->>> filter(lambda item: True if item else False, msg.split('-')) +>>> +>>> filter(bool, msg.split('-')) ['hello', 'world'] ``` diff --git a/source/c01/c01_31.rst b/source/c01/c01_31.rst index e235e95..22ef18e 100644 --- a/source/c01/c01_31.rst +++ b/source/c01/c01_31.rst @@ -69,8 +69,8 @@ >>> msg='hello----world' >>> msg.split('-') ['hello', '', '', '', 'world'] - >>> - >>> filter(lambda item: True if item else False, msg.split('-')) + >>> + >>> filter(bool, msg.split('-')) ['hello', 'world'] |image2|