增加 打印百分比进度.
Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
parent
86dbf3cafc
commit
e7119ab331
|
@ -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))
|
||||
```
|
Loading…
Reference in New Issue