Xiao R didn't have time to learn python yesterday because he was studying the loopholes in weblogic (well, these are all excuses, I'm lazy, everyone can't be like me. I have to insist on learning every day). This progress is a bit slow. Oops, it's okay, I'm still young, only 20 years old. Haha, just kidding.
Today, I continued to learn python file reading and writing, and found a fairly interesting code. Interesting code will be discussed at the end of this article.
This is the file of 1234.txt
Executing this sentence returns 0.
Then:
result:
Understand the role of the code yourself.
Now let's introduce a few lines of code to make a progress bar. Everyone must have played the game, right? When you enter, there will be a progress bar that slowly increases, and this function can be achieved with a few words of python.
Source code: (source code is rarely introduced)
Import sys,time
for i in range(100):
sys.stdout.write("*")
sys.stdout.flush()
time.sleep(0.1)