0
Альтернативные решения
Как Решить данную задачу без использования метода join names = ["John\n", "Oscar\n", "Jacob\n"] file = open("names.txt", "w+") #write down the names into the file b=''.join(names) file.write(b) file.close() file= open("names.txt", "r") #output the content of file in console print(file.read()) file.close()
2 ответов
+ 2
b = f"{names[0]}{names[1]}{names[2]}"
+ 1
names = ["John", "Oscar", "Jacob"]
file = open("names.txt", "w+")
#write down the names into the file
for x in names: print(x)
file.close()
file= open("names.txt", "r")
#output the content of file in consol
cont = file.read()
print(cont)
file.close()
It took me a little bit less than forever to do it.