From b72b44318c0de52befe003c14297cae9f7a283c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Sat, 25 Jun 2016 22:32:02 +0700 Subject: [PATCH] [utils] Add strip_or_none --- youtube_dl/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index de66cb482..a375282f2 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1660,6 +1660,10 @@ def float_or_none(v, scale=1, invscale=1, default=None): return default +def strip_or_none(v): + return None if v is None else v.strip() + + def parse_duration(s): if not isinstance(s, compat_basestring): return None