Logo

Programming-Idioms

History of Idiom 110 > diff from v40 to v41

Edit summary for version 41 by foo:
[Python] remove unnecessary complication

Version 40

2019-09-26, 20:22:08

Version 41

2019-09-26, 20:40:16

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Code
blank = s == '' or s.strip() == ''
Code
blank = s.strip() == ''