一些基础语法

1.使用 \ 将一行语句分为多行显示

statement = "hello world " + \

      "this is my first time of creating blog in cnblogs " + \

      "I am very excited"

print(statement)

output : "hello world this is my first time of creating blog in cnblogs I am very excited"

 

2.语句中包含[],{},()的不要用多行连接符\

days = ['Monday','Tuesday',
   'Wednesday','Thursday','Friday']

 

3.三引号可以用来编写多行句子

statement = """我是第一行

我是第二行"""

输出的结果是两行

 

posted on 2018-01-07 15:42  chungehpu  阅读(104)  评论(0编辑  收藏  举报

导航