python-day7--%s与%d的使用,python2中的input及raw_input

#coding:utf-8   #utf-8格式打开
#%s %d
# name='egon'
# age=18
# print('my name is',name)
# print('my name is my age is',name,age)
#%s既能接收字符串,也能接收数字
# print('my name is %s my age is %s' %(name,age))

#%d只能接收数字
# print('\033[45mmy name is %s my age is %d\033[0m' %(name,age)) # \033[45m \033[0m 调整输出颜色
# print('my name is \033[45m%s\033[0m my age is \033[46m%d\033[0m' %(name,age))


# msg='''
# ------%s info------
# name:%s
# age:%s
# sex:%s
# height:%s
# ---------------------
# ''' %('alex','alex',18,'female',165)
# print(msg)


# while True:
# name=input('name: ')
# age=input('age: ')
# sex=input('sex: ')
# height=input('height: ')
# msg='''
# ------%s info------
# name:%s
# age:%s
# sex:%s
# height:%s
# ---------------------
# ''' %(name,name,age,sex,height)
# print(msg)






#python2 的input 与raw_input
#python3只有input
# x=raw_input('>>: ') #python2的raw_input与python3的input的一样的
# print(x,type(x))

# x=input('>>: ') #python2的input,用户输入什么类型,就原封不动的存成什么类型
# print(x,type(x))
posted @ 2017-07-19 16:07  Cool·  阅读(531)  评论(0编辑  收藏  举报