improve adding quotes, improve reading quotes

This commit is contained in:
Rykov7
2023-01-03 00:42:33 +03:00
parent c597fb7005
commit a83bd54da8
5 changed files with 19 additions and 11 deletions
+1 -2
View File
@@ -1,10 +1,9 @@
""" Stan quote generator. """
import random
quotes = [i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8')]
def speak(chance_of):
number = random.randint(0, chance_of)
if number == 0:
quotes = (i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8'))
return random.choice(quotes)