aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-06-25 22:32:02 +0700
committerSergey M․ <dstftw@gmail.com>2016-06-25 23:19:18 +0700
commitb72b44318c0de52befe003c14297cae9f7a283c3 (patch)
treee624cabecd29f6c200826638b8bfbb58f44514b6 /youtube_dl
parent46f59e89ea1e75bf2bd1657f0863a3e5e81f91ea (diff)
[utils] Add strip_or_none
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/utils.py4
1 files changed, 4 insertions, 0 deletions
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