python爱心代码动态高级 输出代码
时间: 2023-11-17 18:02:38 浏览: 262
```python
import time
def heart():
print("\033[31m", end="")
time.sleep(0.1)
print(" LOVE ", end="")
time.sleep(0.1)
print("YOU", end="")
time.sleep(0.1)
print(" \033[0m", end="")
time.sleep(0.1)
print("\033[33m", end="")
time.sleep(0.1)
print(" LOVE ", end="")
time.sleep(0.1)
print("YOU", end="")
time.sleep(0.1)
print(" \033[0m", end="")
time.sleep(0.1)
print("\033[32m", end="")
time.sleep(0.1)
print(" LOVE ", end="")
time.sleep(0.1)
print("YOU", end="")
time.sleep(0.1)
print(" \033[0m", end="")
time.sleep(0.1)
print("\033[36m", end="")
time.sleep(0.1)
print(" LOVE ", end="")
time.sleep(0.1)
print("YOU", end="")
time.sleep(0.1)
print(" \033[0m", end="")
time.sleep(0.1)
print("\033[35m", end="")
time.sleep(0.1)
print(" LOVE ", end="")
time.sleep(0.1)
print("YOU", end="")
time.sleep(0.1)
print(" \033[0m", end="")
time.sleep(0.1)
print("\033[34m", end="")
time.sleep(0.1)
print(" LOVE ", end="")
time.sleep(0.1)
print("YOU", end="")
time.sleep(0.1)
print(" \033[0m", end="")
time.sleep(0.1)
print("\033[31m", end="")
time.sleep(0.1)
print(" LOVE ", end="")
time.sleep(0.1)
print("YOU", end="")
time.sleep(0.1)
print(" \033[0m")
time.sleep(0.5)
while True:
heart()
```
阅读全文