python百例

49-动画程序:@从一行#中穿过

2018-07-31  本文已影响11人  凯茜的老爸

\r是回车不换行

import time

length = 19
count = 0

while True:
    print('\r%s@%s' % ('#' * count, '#' * (length - count)), end='')
    try:
        time.sleep(0.3)
    except KeyboardInterrupt:
        print('\nBye-bye')
        break
    if count == length:
        count = 0
    count += 1
上一篇下一篇

猜你喜欢

热点阅读