Python 语法

 1 """
 2 
 3 if 条件1:
 4     内容
 5 elif 条件2:
 6     内容2
 7 elif 条件3:
 8     内容3
 9 else:
10     内容
11 
12 
13 
14 
15 inp = input('>>>>')
16 inp2 = input("======")
17 
18 if inp == "1":
19     print('11111')
20 elif inp == "2" and inp2 == "3":
21     print("2222")
22 elif inp == "4" or inp =="5":
23     print("444555")
24 else:
25     print('.......')
26 
27 
28 True False
29 
30 > < == != or and 
31 
32 
33 while 条件:
34     代码块
35 break 跳出当前循环
36 continue 终止本次循环 开始下一次循环
37 
38 """
39 
40 
41 import time
42 
43 n = 1
44 flag = True
45 while flag:
46     print (n)
47     if n == 10:
48         break
49 
50     if n == 6:
51         continue
52     
53     n = n+1
54     time.sleep(1)
55 
56 print("end")

 

posted on 2017-08-18 22:00  blo  阅读(89)  评论(0)    收藏  举报

导航