#!/usr/bin/env python
# _*_ coding: utf-8 _*_
num = 100
name = input("your name:")
age = input("your age:")
print (name,age) #input 接受的所有数据都是字符串,即便输入的是数字,依然会当作字符串处理
print (type(age))
# c:\python_note>python 8、python基础知识-用户输入.txt
# your name:abc
# your age:12
# abc 12
# int integer 整数 把字符串转换成int ,用int(被转的内容)
# str string 字符串 把整数转换成字符串,用str(被转的内容)
print ("your name:",name)
# print ("your num",num - int(age),"...")
print ("your num " + str(num - int(age)) + " ...")
# c:\python_note>python 8、python基础知识-用户输入.txt
# your name:aksdf
# your age:89
# aksdf 89
# <class ‘str‘>
# your name: aksdf
# your num 11 ...
原文:https://www.cnblogs.com/hlc-123/p/10920506.html