Python learning _2

Single-line comments with a pound sign #

Multi-line comments with three single or double quotes

If you assign to the annotation content, you can represent print multiple lines, such as:

1 msg = '''111
2 222
3 333
4 4'''
5 print(msg)

Formatted output

 

Flag: In order to execute the first break, then a second break, you can add a flag, exit_flag = False

 1 exit_flag = False
 2 for i in range(10):
 3     if i < 5:
 4         continue
 5     print(i)
 6     for j in range(10):
 7         print("layer2", j)
 8         if j == 6:
 9             exit_flag = True
10             break
11     if exit_flag:
12         break

 

Guess you like

Origin www.cnblogs.com/xihamhl/p/11104320.html