Reputation: 55
py 2.7 I want to append a new line to my string when I call a.write() the problem is that the contenent is a variable. so, when i write
a.write(x,"/n")
it gives me error cause i can't put more than 1 argument in (). any suggest?
Upvotes: 0
Views: 11918
Reputation: 52071
There are many ways of doing it
a.write(x+"\n")
a.write('{}\n'.format(x)
a.write('%s\n'%(x))
Note - \n
is newline and not /n
Upvotes: 3