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

Python用户终端输入

时间:2018-09-25 01:28:18      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:操作   put   转化   pre   退出   int   exit   ase   err   

#用户输入,操作
print("python 用户输入操作")

# input(提示字符串),函数阻塞程序,并提醒用户输入字符串
instr = input("please input the string: ")
print("input >> " + instr)

# 将输入的字符串转化成整数  int(str)
print("input to int >> " + str(int(instr)))

# 练习,输入字符串为exit时才退出用户输入

while input("please input: ")!="exit":
    print("input error")

 

Python用户终端输入

标签:操作   put   转化   pre   退出   int   exit   ase   err   

原文地址:https://www.cnblogs.com/BlogsOfLei/p/9697156.html

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