博客
关于我
Python:使用 print 打印“Hello World!”以及其它字符内容
阅读量:167 次
发布时间:2019-02-27

本文共 430 字,大约阅读时间需要 1 分钟。

Python打印函数使用指南

1. Python 3.x版本的print函数

在Python 3.x版本中,print函数是一个内置函数,需要用括号包裹参数。例如:

print("Hello World !")

2. Python 2.x版本的print作为关键字

在Python 2.x版本中,print是关键字,不需要括号,直接写成:

print "Hello World !"

3. 多行输出

在Python中,print函数可以多次调用,输出内容会自然换行:

print("Hello World !")print("你好!")print("谢谢!")

4. 多参数输出

在Python 3.x版本中,print函数支持多个参数,会用空格分隔:

print("1", "2", "3")

5. 多种字符输出

你可以根据需要更改字符内容:

print("你好!")print("再见!")

6. 结束语

今天的学习内容到此结束。如有任何问题欢迎留言讨论。

转载地址:http://joub.baihongyu.com/

你可能感兴趣的文章
Oracle 11g中的snapshot standby特性
查看>>
Oracle 11g关闭用户连接审计
查看>>
Oracle 11g忘记sys、system、scott密码该这样修改!
查看>>
Oracle 11g数据库安装和卸载教程
查看>>
Oracle 11g数据库成功安装创建详细步骤
查看>>
Oracle 11g超详细安装步骤
查看>>
Oracle 12c中的MGMTDB
查看>>
Oracle 12c安装报错Installation failed to access the temporary location(无法访问临时位置)...
查看>>
Oracle 9i数据库管理教程
查看>>
ORACLE Active dataguard 一个latch: row cache objects BUG
查看>>
oracle avg、count、max、min、sum、having、any、all、nvl的用法
查看>>
Oracle BEQ方式连接配置
查看>>
oracle Blob保存方式,oracle 存储过程操作blob
查看>>
Oracle BMW Racing sailing vessel帆船图
查看>>
ORACLE Bug 4431215 引发的血案—原因分析篇
查看>>
Oracle Business Intelligence Downloads
查看>>
Oracle cmd乱码
查看>>
Oracle Corp甲骨文公司推出Oracle NoSQL数据库2.0版
查看>>
【Docker知识】将环境变量传递到容器
查看>>
uniapp超全user-agent判断 包括微信开发工具 hbuilder mac windows 安卓ios端及本地识别
查看>>