如何找到整数位数? [英] How to find length of digits in an integer?

查看:100
本文介绍了如何找到整数位数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Python中,如何找到整数位数?

In Python, how do you find the number of digits in an integer?

推荐答案

如果您希望整数的长度与整数的位数相同,则始终可以将其转换为类似于str(133)的字符串并找到其长度像len(str(123)).

If you want the length of an integer as in the number of digits in the integer, you can always convert it to string like str(133) and find its length like len(str(123)).

这篇关于如何找到整数位数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆