File write/line,csv
code: python
def create_test_file(filepath: str):
csv_data = [
]
text_blocks = [
"This is line",
"This is second line\nit is iteresting thing",
"This is third line"
]
try:
with open(filepath, 'w') as f:
for row in csv_data:
f.write(','.join(row) + '\n')
f.write('\n')
for block in text_blocks:
f.write(block + '\n')
f.write('%\n')
print(f"File created successfully: {filepath}")
except Exception as e:
print(f"Error creating file: {e}")
if __name__ == "__main__":
create_test_file("test.csv")