LoginSignup
0
0

More than 5 years have passed since last update.

めざせpythonライブラリマスター (17)rangeparser

Last updated at Posted at 2016-06-04

【ライブラリ説明】

 自由に数値の範囲リスト作成
 

【準備】

 python2.7ではインストールできなかったので、python3.5で動かしました。

【プログラム】

rangeparser.py
# -*- coding: utf-8 -*-

from rangeparser import RangeParser

parser = RangeParser()

print(parser.parse('10,20,30'))
# [10, 20, 30]

print(parser.parse('1-10'))
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

print(parser.parse('10,20,30,40-45'))
# [10, 20, 30, 40, 41, 42, 43, 44, 45]

【参考サイト】

 pypi

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0