Skip to content

Commit 2e480fd

Browse files
committed
增加了toList()方法
1 parent a073894 commit 2e480fd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

type.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
"""
2+
对Python原版类型的扩展
3+
"""
14
__author__ = "Jerry"
2-
__version__ = "1.2.4"
5+
__version__ = "1.2.5"
36

47
class NotComposedOfNumbersError(Exception):
58
"不是由数字组成的字符串使用String对象的toInt()函数或toInteger()函数时抛出"
@@ -120,6 +123,10 @@ def subString(self, /, range1, range2=None):
120123
range2 = range1 + 1
121124
return String(self.__str[range1:range2])
122125

126+
def toList(self):
127+
"将字符串转换为列表"
128+
return list(self.__str)
129+
123130
def toInt(self):
124131
"如果能,将字符串转成整数,否则抛出NotComposedOfNumbersError异常"
125132
try:

0 commit comments

Comments
 (0)