A
A
amoor2016-09-17 11:17:51
Python
amoor, 2016-09-17 11:17:51

How to display input?

Hello. There is a code:

data = input('Введите данные: ')
file = input('Введите имя файла в который будут помещены данные: ')
expans = input('Введите расширение файла: ')

li = [data]

f = open(file, 'a')
f.write("\nВведённые данные: {}\n\n".format(li[0]))

f.close()

The idea is this: the user enters the data and the file where to save it, then he enters the file extension, but input where you need to specify the extension is not displayed. I don't have the slightest idea what the problem is. I ask you to help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2016-09-17
@spidespidepide

Everything works for me without changes. The file has been created, it contains your data.
Maybe you are creating the script in the wrong encoding?
It is necessary that the encoding of the script matches the encoding of the console in which it is launched.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question