Home>
for BBB in AAA:
F = open ("ARTICLES", "a")
    f.write (BBB)
    f.close ()

AAA has an array. I want to write the contents of AAA line by line, but with the above program, only the first sentence can be written. How can I improve it?

  • Answer # 1

    Because there is no line break when writing, it's just that it's hard to see because the information is mixed.
    Try f.write ('\ n') after outputting BBB as a test.

    Or without using a for statement

    f.write ('\ n'.join (AAA))

    print (* AAA, sep = '\ n', file = f) may be used.

Trends