Answer the question
In order to leave comments, you need to log in
Python code is not working correctly, what's wrong?
This is a program for simplified creation of a .bat file that creates a matrix effect in cmd. The bottom line is that it seems to work and create a batch file, but inside it is absolutely empty. Help me decide!!
print('Привет я программа которая создаёт эффект матрицы')
batname = input('Как назовём твой софт?')
print('Какого цвета будет текст?')
cvet = input('1:Белый, 2:Зелёный, 3:Голубой, 4:Красный, 5:Жёлтый')
text = input('Введи текст который должен плыть по экрану...Для вывода рандомных цифр введи 1488')
Cvet = ()
Text = ()
#назначение цвета
if cvet == "1":
Cvet = str('color f')
if cvet == "2":
Cvet = str('color a')
if cvet == "3":
Cvet = str('color b')
if cvet == "4":
Cvet = str('color c')
if cvet == "5":
Cvet = str('color e')
#Назначение текста
if text == "1488":
Text = "%random% %random% %random% %random% %random% %random% %random% %random%"
else:
Text = text
#Добавление в файл
file = open(r"programm" + '.bat', 'w')
lines = [str(Cvet), str(Text)]
file.write(lines + '\n' )
file.close()
Answer the question
In order to leave comments, you need to log in
#Write to file
file = open(batname + '.bat', 'w')
file.write(Cvet + '\n' + Text)
file.close()
Have you tried running the script at all? He falls into error.
Traceback (most recent call last):
File "app.py", line 6, in
file.write(lines + '\n' )
TypeError: can only concatenate list (not "str") to list
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question