Logo

Programming-Idioms

History of Idiom 110 > diff from v38 to v39

Edit summary for version 39 by Anonymous:
[Python] Explicit is better than implicit.

Version 38

2019-09-26, 17:59:31

Version 39

2019-09-26, 18:22:29

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 is None or not s.strip()
Code
blank = s == '' or s.strip() == ''