python的print 功能
来源:互联网 发布:逐点比较圆弧插补算法c 编辑:程序博客网 时间:2024/06/05 15:53
print 字符串和print 字符串叠加
print(1)
1>>> print('hellow world and hql')
hellow world and hql
>>> print("hello world and hql")
hello world and hql
>>> print ('hello world'+" "+'hello world hql')
hello world hello world hql
简单运算:
2
>>> print(8-2)
6
>>> print(3*4)
12
>>> print(12/4)
3.0
>>> print(5+"hql") # 字符串不可以直接和数字相加
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
print(5+"hql") # 字符串不可以直接和数字相加
TypeError: unsupported operand type(s) for +: 'int' and 'str'
>>> print(int('2'+3))
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
print(int('2'+3))
TypeError: must be str, not int
>>> print(int('3')+2)
5
>>> print(int(2.4)) # 当int一个浮点型数时,int会保留整数部分
2
>>> print(float('5.4')+3) # float()是浮点型,可以把字符串转换成小数
8.4
>>>
0 0
- python的print 功能
- python的print函数的一些功能
- python 的print输出
- Python的print函数
- Python的print用法
- python的print
- Python Print的扩展
- python的输出 print print, write
- Python的print 格式化输出
- Python的print 格式化输出
- python新版本的print使用
- python print的简单用法
- python print UUID的问题
- 《python print -> print() 》
- Python语言的Human-Readable Print(Pretty Print)
- Python语言的Human-Readable Print(Pretty Print)
- python print
- python print
- 2017.1.09-2017.1.13面试总结
- Lamp-IDE开发环境-NotePad++/Vim/Sublime Text
- [后缀数组]spoj694 Distinct Substrings/spoj705 New Distinct Substrings
- ROS入门_1.8 理解ROS节点
- 微信小程序开发之网络请求(POST请求)
- python的print 功能
- Linux一键安装web环境全攻略(阿里云服务器)
- [资料]L1算法代码大合集
- java面向对象主要有四大特性
- CSS3新属性box-flex移动端利器
- 设计模式之工厂方法模式
- POI 读取数值转换问题
- Maven missing artifact 问题解决
- 《Zero to One》