We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26580e8 commit 4426f63Copy full SHA for 4426f63
type.py
@@ -2,7 +2,7 @@
2
对Python原版类型的扩展
3
"""
4
__author__ = "Jerry"
5
-__version__ = "1.2.5"
+__version__ = "1.2.6"
6
7
class NotComposedOfNumbersError(Exception):
8
"不是由数字组成的字符串使用String对象的toInt()函数或toInteger()函数时抛出"
@@ -229,6 +229,13 @@ def isOdd(self):
229
else:
230
return True
231
232
+ def isDivisible(self, number):
233
+ "判断数字是否能被某个数整除,返回布尔值"
234
+ if type(number) is Integer:
235
+ return self.__int % number.__int == 0
236
+ else:
237
+ return self.__int % number == 0
238
+
239
def replace(self, /, past, now):
240
"在前一个括号内填写字符串内要匹配的元素,后一个括号内填入要被替换成的元素,这样所有匹配的元素都会被替换为要被替换成的元素,最后返回Integer对象"
241
return Integer(int(self.toStr().replace(past, now)))
0 commit comments