text_file = StringIO()
text_file.write("История 1")
text_file.write("\r\n")
text_file.write("История 2")
text_file.write("\r\n")
text_file.write("История 3")
text_file.write("\r\n")
text_file.write("История 4")
text_file.write("\r\n")
text_file.seek(0)
def all_stories():
return [storie for storie in text_file.readlines() if "\r\n"]
def get_storie(index):
return all_stories()[index]
print(get_storie(0))
print(get_storie(1))
stories = ["История 1", "История 2"]
stories.append("А также история 3")