Home >Backend Development >Python Tutorial >How to pause execution in Python3.X

How to pause execution in Python3.X

little bottle
little bottleforward
2019-04-09 11:25:203084browse

Nowadays, a large part of the statements in Python3 are not interoperable with Python2. Many functions are slightly different, and the methods of running pauses are also different. Today I will take you to learn about the method of running pauses in Python3. .

1. input();

This method does not need to include modules, so this is also the most commonly used pause method.

The raw_input() and input() statements in Python2 have been merged into input() in Python3.

2. os.system("pause");

This method needs to include the os module (import os). Running IDLE under Windows will pop up the cmd command line,

Perform a pause operation. Directly running the .py file will pause directly in the command line.

3. time.sleep("second");

This method needs to include the time module (import time), second is a customized time length, depending on the actual situation,

Fluctuations may occur.

[Recommended course: Python3 video tutorial]

The above is the detailed content of How to pause execution in Python3.X. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete