Python AttributeError: module 'string' has no attribute 'atoi'

版权声明:版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/DarrenXf/article/details/83178433

python2 中可以用string.atoi 在python3中会报错
替换的方案是

string.atoi(your_str)

替换为

int(your_str)

这个代码python2和python3都可以运行.

猜你喜欢

转载自blog.csdn.net/DarrenXf/article/details/83178433