1 #!/usr/bin/env python
2 #coding=utf-8
3 a = 3
4
5 _aa = 3
6
7 a3 = 3
8
9 _aa3 = 3
1 >>> import keyword
2 >>> keyword.kwlist
3 ['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
1 '''
2 now you cann't run this code!
3 print ("hello world")
4
5 '''
6
7 """
8 now you cann't run this code!
9 print ("hello world")
10
11 """
1 #单行缩进格式
2
3 if True:
4 print('ok')
5 else:
6 print('no good')
7 if aa=='ok':
8 print('ok')
9
10 while count>1000:
11 if b!='name':
12 break
13 else:
14 print('2222')
15
16 #多行缩进:
17 total = item_one + \ #如果语句很长,可以使用反斜杠(\)来实现多行语句
18 item_two + \
19 item_three
20
21
22 total = ['item_one', 'item_two', 'item_three',
23 'item_four', 'item_five']
View Code