How to write multiple strings in one line?

后端 未结 11 633
谎友^
谎友^ 2020-12-01 03:28

I\'ve started to learn Python with LPTHW and I\'ve gotten to exercise 16:

http://learnpythonthehardway.org/book/ex16.html

And feel like an idiot because I ca

11条回答
  •  [愿得一人]
    2020-12-01 03:43

    This info was really helpful. I got the right results by doing the following:

    target.write(line1 + "\n" + line2 + "\n" + line3 + "\n")
    

    The idea of concatenating would never have occurred to me.

提交回复
热议问题