Python 将元组转换为整数

标签 python integer tuples

有没有函数可以将元组转换为整数?

例子:

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/

相关文章:

java - 列出任何除以五或六的整数

c++ - 如何解压在 mixins 主机类中传递的一组元组(最终被转发给 mixins)

F# 构造函数不接受元组?

python - 使用 Python 在 Linux 终端中同时运行进程

python - urllib引用问题: dealing with â characters from a latin-1 database

python - 如何在核心处理程序中获取信息

python - Spacy:保存解析后的模型

arrays - 如何将字符串整数数组转换为整数数组? ruby

java - "If the number is contained in the text and is repeated, return the sum of the number for each time it is repeated. Otherwise return 0."

python - 如何在 Python 中创建一个空元组的元组?