Answer the question
In order to leave comments, you need to log in
What's wrong with a list in python?
I read a multiline file:
with open('stcret_file', 'r') as file:
answers = file.read()
file.close()
print(answers)
Нормальная
Нет
Да
Нет
Нет
Нет
Нет, не имею
Нет
Да
Answer the question
In order to leave comments, you need to log in
1e - if you use with , then you do not need to close the file explicitly, when you exit the with block, it will do it itself.
2e - the read() method returns a string, that is, answers is a string, you can make
print(type(answer))
sure that answer[0] is a space
3e - to get a list, you need to use readlines() instead of read()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question