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

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

哈喽,大家好!我是wangzirui32,这是我的第一篇博文,发现内容有误还请多多提出!谢谢!

今天,我们将使用Python的print,来帮助我们让程序输出指定内容。
如果你的Python版本是3.x,
print 将作为一个Python内置函数,
要这样写:

print("Hello World !")

但如果Python版本是2.x,

print 将作为关键字使用,
不需要括号,
应该这样子写:

print "Hello World !"

最终结果都会输出 Hello World !

除此之外,你还可以更改引号内的字符,也可以输入中文,如改成 “你好!”;也可以多写几行,如:

Python 3.x

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

Python 3.x版本的print函数可以有多个参数,输出时会用空格隔开,比如:

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

将会输出:

1 2 3

今天的课程到这儿就结束了,拜拜!

有什么问题可以在评论区说出来哟~
还有,我的文章准备都做Python3.x版本,尽情期待吧!

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

你可能感兴趣的文章
Mysql8.0注意url变更写法
查看>>
Mysql8.0的特性
查看>>
MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看>>
MySQL8修改密码的方法
查看>>
Mysql8在Centos上安装后忘记root密码如何重新设置
查看>>
Mysql8在Windows上离线安装时忘记root密码
查看>>
MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案
查看>>
mysql8的安装与卸载
查看>>
MySQL8,体验不一样的安装方式!
查看>>
MySQL: Host '127.0.0.1' is not allowed to connect to this MySQL server
查看>>
Mysql: 对换(替换)两条记录的同一个字段值
查看>>
mysql:Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘解决方法
查看>>
MYSQL:基础——3N范式的表结构设计
查看>>
MYSQL:基础——触发器
查看>>
Mysql:连接报错“closing inbound before receiving peer‘s close_notify”
查看>>
mysqlbinlog报错unknown variable ‘default-character-set=utf8mb4‘
查看>>
mysqldump 参数--lock-tables浅析
查看>>
mysqldump 导出中文乱码
查看>>
mysqldump 导出数据库中每张表的前n条
查看>>
mysqldump: Got error: 1044: Access denied for user ‘xx’@’xx’ to database ‘xx’ when using LOCK TABLES
查看>>