码迷,mamicode.com
首页 > 编程语言 > 详细

python-input

时间:2016-11-20 15:48:54      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:转换   str   返回   blog   log   int   pytho   类型转换   highlight   

input()返回的数据类型是strstr不能直接和整数比较,必须先把str转换成整数。Python提供了int()函数来完成这件事情

s=input(‘pleas input your age‘)

age=int(s)

#把str的类型转换成整数类型

  

python-input

标签:转换   str   返回   blog   log   int   pytho   类型转换   highlight   

原文地址:http://www.cnblogs.com/beNabenen/p/6082641.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!