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|