Differences between Interactive Mode (IDLE) and running as a file on Python?

Asked 2 years ago, Updated 2 years ago, 50 views

a='Lee'

a.upper()

a.find('e')

When you run an interactive line-by-line in IDLE, you run a line-by-line and the results appear immediately. In the example above, the result a.upper() is LEE, and a.find('e') is 1. By the way, this file is tested.If you save it as py and run python test.py, no results appear.

What's the reason?

python

2022-09-22 18:15

1 Answers

Interactive mode is called REPL.

REPL stands for Read Eval Print Loop and outputs the results immediately after evaluation.

In other words, IDLE operates in interactive mode, so if you type enter, you can see the results immediately without printing is not required. However, if you run the py file right away, you need to print it out before it appears on the screen.


2022-09-22 18:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.