Regressive python counter
i was doing a small weekend project, kind of a musi开发者_运维技巧c player, in python (console). I'm done in all the part of selecting music, parsing ID3 tags, playing and blablabla. I just think i need something like a counter to show the music's total time and played time.
Basically what i need is to print a string, erase only that string and print it again. I don't care if i need any external libraries for this, but i need it to be windows if exists.
So, is there any way to do this on python? Thanks in advance.
You should look at the curses module which provides more control over the console. It is built into python.
EDIT
Apparently the standard library curses isn't available on Window, but you can look at using this: http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
But a simpler strategy is to use "\b" it is a backspace character.
sys.stdout.write("a\b")
Has no output because the a is erase. You might be able to use that.
精彩评论