Проблемы вывода ANSI в .exe
all_flags = []
import os
import climage as cl
import random
import time as t
for file in os.listdir('D:\AllFlags'):
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('D:\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!')
score += 1
else:
print('Wrong!')
lives -= 1
print('You have {} lives'.format(lives))
print('You lose!')
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
В пичарме флаги выглядят неплохо, но после конвертации этого кода в exe, бывший флаг это просто набор символов, и это нужно пофиксить