В добавок к предыдущему вопросу, проблема вывода Ansi, но проблема уже в модуле colorama
all_flags = []
import os
import climage as cl
import random
import time as t
from colorama import init
init()
directory = str(os.getcwd())+'\\AllFlags'
for file in os.listdir(directory):
all_flags.append(file.split('.')[0])
def random_flag():
return random.choice(all_flags)
def game():
lives = 3
score = 0
print('Hello!')
t.sleep(1)
print('You quess the flag')
t.sleep(1)
print('You have 3 lives')
t.sleep(1)
print('Good luck!')
while lives > 0:
t.sleep(1)
flag = random_flag()
output = cl.convert(os.getcwd()+'\\AllFlags\\' + flag + '.png')
print(output)
t.sleep(1)
list_of_answers = [flag, random_flag(), random_flag(), random_flag()]
a = 3
for i in range(3):
q = random.randint(0, a)
print(list_of_answers.pop(q))
a -= 1
print(list_of_answers[0])
t.sleep(1)
answer = input('What is the flag? ')
if answer == flag:
print('Right!')
t.sleep(1)
score += 1
else:
print('Wrong!')
t.sleep(1)
lives -= 1
print('Right answer is ' + flag)
t.sleep(1)
print('You have {} lives'.format(lives))
print('You lose!')
t.sleep(1)
print('Your score is {}'.format(score))
while True:
game()
print('Do you want to play again? (y/n)')
answer = input()
if answer == 'y':
continue
else:
break
Теперь код выглядит так, в екзешном виде теперь вместо символов пустое пространство, в чем я ошибся?