增加 打印百分比进度.

Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
rick.chan 2020-09-22 17:32:05 +08:00
parent 86dbf3cafc
commit e7119ab331
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
# 打印百分比进度
```cpp
#include <iostream>
#include <unistd.h>
for(int i=0; i<100; i++)
{
cout<<flush<<'\r'<<"Writed: "<<i+1<<"/"<<100;
usleep(200000);
}
cout<<endl;
```
```python
for i in range(0, 99):
print('\rWrited: %.1f%%'%(100*i/100), end = '')
sys.stdout.flush()
#
print('\rWrited: %.1f%%'%(100*100/100))
```