diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-11-20 20:31:41 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-11-20 20:31:41 +0100 |
commit | 9daa599e88d66cb7e4c4768f45630bccdf5d60fd (patch) | |
tree | 008b3238654b9b4c86423b2d5fc4fac86d50b609 /python/002-simple-re-within-string.py | |
parent | 01df9960e6bd4a99d982eae32182d86146498812 (diff) | |
download | snippets-9daa599e88d66cb7e4c4768f45630bccdf5d60fd.tar.gz snippets-9daa599e88d66cb7e4c4768f45630bccdf5d60fd.tar.xz snippets-9daa599e88d66cb7e4c4768f45630bccdf5d60fd.zip |
Add python/002-simple-re-within-string.py
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'python/002-simple-re-within-string.py')
-rw-r--r-- | python/002-simple-re-within-string.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/python/002-simple-re-within-string.py b/python/002-simple-re-within-string.py new file mode 100644 index 0000000..5259418 --- /dev/null +++ b/python/002-simple-re-within-string.py @@ -0,0 +1,9 @@ +version_start, version_stop = reduce( + lambda acc, x: (acc[0] if acc[0] or not x[1].isdigit() else x[0]+1, + acc[0] if not x[1].isdigit() else x[0]+1), + enumerate(options.version), (0, 0) +) +if not version_start: + options.version = '0' +else: + options.version = options.version[version_start-1:version_stop] |