You can use a random function.
At the top of the code:
import random
Then run:
index = random.randint(0,len(content))
to index it later just use:
print(content[index])
So:
import random
def main():
import time
import os
os.system('cls')
print("███╗ ███╗██╗ ██╗███████╗██╗ ██████╗ ██████╗ ██╗ ██╗██╗███████╗")
print("████╗ ████║██║ ██║██╔════╝██║██╔════╝ ██╔═══██╗██║ ██║██║╚══███╔╝")
print("██╔████╔██║██║ ██║███████╗██║██║ ██║ ██║██║ ██║██║ ███╔╝")
print("██║╚██╔╝██║██║ ██║╚════██║██║██║ ██║▄▄ ██║██║ ██║██║ ███╔╝ ")
print("██║ ╚═╝ ██║╚██████╔╝███████║██║╚██████╗ ╚██████╔╝╚██████╔╝██║███████╗")
print("╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚══??═╝ ╚═════╝ ╚═╝╚══════╝")
print("")
print("")
print("Made By *****")
time.sleep(2)
content = []
with open('songs.txt', 'r') as f:
for line in f:
content.append(line.strip('
'))
index = random.randint(0, len(content)-1)
print(content[index])
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…