提供字母数字类型的包
AlphaAffixedNumericType的Python项目详细描述
字母表数字类型(aant)
Python数据类型来支持字母数字字符串上的算法
支持的算法类型
- 在
添加
在aant + integer
*注意:整数类型必须在加法运算符的右侧 - 在
减法
在aant - [integer|aant]
如何使用
fromAlphaAffixedNumericTypeimportAlphaAffixedNumericTypeaant=AlphaAffixedNumericType('A123')print(aant+1)# prints 'A124' print(aant+1000)# prints 'A1123' aant+=10print(aant.get_value())# prints 'A133'aant2=AlphaAffixedNumericType('A123B')aant3=AlphaAffixedNumericType('A124B')print(aant2-aant3)# prints -1 print(aant2-200)# raises 'NumericArithmeticException' - Numeric part of aant2 (123) is less than 200aant4=AlphaAffixedNumericType('A0001B')print(aant4+1000)# prints 'A1001B'
- 项目
标签: