有没有函数可以将元组转换为整数?
例子:
input = (1, 3, 7)
output = 137
最佳答案
>>> reduce(lambda rst, d: rst * 10 + d, (1, 2, 3))
123
关于Python 将元组转换为整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10062673/
有没有函数可以将元组转换为整数?
例子:
input = (1, 3, 7)
output = 137
最佳答案
>>> reduce(lambda rst, d: rst * 10 + d, (1, 2, 3))
123
关于Python 将元组转换为整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10062673/