V
V
⚡Valery⚡2015-10-02 18:38:14
Python
⚡Valery⚡, 2015-10-02 18:38:14

How to make that from a new line?

mass = [edit1.get() + ' ',edit2.get()+ ' ',edit3.get()]
str1 = open(r'File.txt','a')
str1.writelines(mass)
str1.close()

If you do str1.writelines(mass+"\n")
it writes -writelines() takes exactly 1 argument (2 given) Tell me
how to make it add everything from a new line and not in a row

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
abs0lut, 2015-10-02
@valo1114

Try like this:

mass = [edit1.get() + ' ',edit2.get()+ ' ',edit3.get()]
str1 = open(r'File.txt','a')
str1.writelines("".join(mass) + "\n")
str1.close()

Y
Yuri Koshurnikov, 2015-10-03
@gaku_chan

There is also an option :)

mass = [edit1.get(), edit2.get(), edit3.get()]
# для python 3
print("\n".join(mass),file=open(r'File.txt', 'a'))
# для python 2
print >>open(r'File.txt', 'a'), "\n".join(mass)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question