Files
Python-Schulung/Mittwoch/write_file.py
2022-11-23 18:10:46 +01:00

13 lines
311 B
Python

#! /usr/bin/env python3
def write_into_files(path, lines):
with open(path, 'w') as outfile:
for line in lines:
print(line, file=outfile)
pass
lines = ["Das ist ein zeichen", "Das ist ein zweites zeichen0000"]
lines.append("Next line")
write_into_files("/tmp/test.txt", lines)