首页 > 编程语言 > 详细

python入门8 输入输出

时间:2018-11-04 11:42:58      阅读:129      评论:0      收藏:0      [点我收藏+]

输入 input()

输出 print()

 

#coding:utf-8
#/usr/bin/python
"""
2018-11-03
dinghanhua
输入输出
"""

‘‘‘输出print‘‘‘
print(‘hello ‘) #结尾end默认换行
print(‘world‘)

print(‘hello ‘,end=‘\t‘) #制定end
print(‘world‘)

print(‘a‘,‘b‘,‘c‘,sep=‘-‘) #sep指定分隔符

 

‘‘‘打印乘法口诀表‘‘‘
for i in range(1,10):
    for j in range(1,i+1):
        if i==j:
            print(i, ‘*‘, j, ‘=‘, i * j,end=‘\n‘)
        else:
            print(i,‘*‘,j,‘=‘,i*j,end=‘\t‘)

 

‘‘‘输入input‘‘‘

i = input(‘输入整数‘)
print(type(i))  #不管输入什么都是字符串类型
print(int(i)+100)

 

python入门8 输入输出

原文:https://www.cnblogs.com/dinghanhua/p/9903375.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!