Python Write Line to File

July 15, 2019
data = [
    'Row 1',
    'Row 2',
    'Row 3'
]

with open('test.txt', 'w') as f:
    for row in data:
        f.write(f"{row}\n")
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.