20.6. 列表-代码块
以下3种效果相同:
一. 不缩进,无空行
1 2 3 4 5 6 | - list1 ```python text1 = "Hello, " text2 = "world!" print text1 + text2 ``` |
二. 缩进,无空行
1 2 3 4 5 6 | - list1 ```python text1 = "Hello, " text2 = "world!" print text1 + text2 ``` |
三. 缩进,有空行
1 2 3 4 5 6 7 | - list1 ```python text1 = "Hello, " text2 = "world!" print text1 + text2 ``` |
效果均如下
-
list1
1 2 3
text1 = "Hello, " text2 = "world!" print text1 + text2
注意: 不能无缩进却有空行,如下面这样是有问题的,可以自行测试:
1 2 3 4 5 6 7 | - list1 ```python text1 = "Hello, " text2 = "world!" print text1 + text2 ``` |