Python入门-多行语句
2015-10-08 13:18
399 查看
1. Python语句中一般以新行作为为语句的结束符。
但是我们可以使用斜杠( \)将一行的语句分为多行显示。
2. 语句中包含[], {} 或 () 括号就不需要使用多行连接符。
View Code
但是我们可以使用斜杠( \)将一行的语句分为多行显示。
2. 语句中包含[], {} 或 () 括号就不需要使用多行连接符。
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'] #print days[0] str = 'ab\ cdef' print str total = days[0] + ' ' + \ days[3] print total
View Code
相关文章推荐
- Python入门-行和缩进
- 1.Python标准库_正则表达式 (re包)
- Python变量和类型
- [code] python+selenium实现打开一个网页
- python连接phoenix
- python sys.argv[]用法
- Python re正则表达式
- sublime text3 中输入汉字,程序正常运行,但是python控制台却无法显示中文。
- 编程语言入门经典100例【Python版】
- [python项目一]查找输出fasta序列的gap的起始终止等信息
- python汉语注释
- python list排序的两种方法及实例讲解
- 10 种机器学习算法的要点(附 Python 和 R 代码)
- Python开发入门与实战21-订阅事件(subscribe)
- rabbitmq学习
- 新手学python--字典
- python+sqlite3
- Python GUI with Tkinter (from youtube) 在youtube上能找到很多编程视频...
- Python中的对象的排序
- python脚本: 云服务器集群计算节点客户机网卡状态管理