How to get to a new line in Python Shell?

前端 未结 7 1827
孤独总比滥情好
孤独总比滥情好 2021-02-02 11:20

In IDLE, say i want to write the following in TWO lines:

x = 3

print x**5

but when i type x = 3 and press enter, it executes the assignment. H

7条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-02 11:50

    Use the Ctrl-J key sequence instead of the Enter key to get a plain newline plus indentation without having IDLE start interpreting your code.

    You can find other key sequences that make IDLE easier to use for this type of learning under the Options->Configure IDLE menu.

提交回复
热议问题