跳至主要內容
Python 实现跑马灯效果

你好,我是悦创。

import platform
import os
import sys
import time


def main():
    content = "你好,我是悦创。。。"
    while True:
        # 清理屏幕输出
        if platform.system().lower() == "windows":
            os.system("cls")
        elif 'ipykernel' in sys.modules:
            from IPython.display import clear_output as clear
            clear()
        else:
            os.system("clear")
        print(content)
        # 休眠 300 毫秒
        time.sleep(0.3)
        content = content[1:] + content[0]


if __name__ == '__main__':
    main()

AI悦创原创...大约 1 分钟PythonPython 跑马灯Python 小玩意PythonPython 跑马灯Python 小玩意