简体   繁体   中英

python:how to exit if block during interactive mode

just play with Python, a small question on interactive mode.

steps:

  1. enter python interactive mode, following line shows detail on interactive mode List item
  2. >>>flag=True
  3. >>>if flag:
  4. . . . print("flag is True")
  5. after above step, i WANT to exit the whole if block. but if press enter for above line 4, it will start line with "...", which means still in if block.

question: HOW CAN I exit if block and write sth like the following in interactive mode :

flag=True
if flag:
    print("flag is True")
print("exit if now ")

在交互式模式下,按两次Enter将退出if块

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM