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
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.
© 2024 OneMinuteCode. All rights reserved.