Код: Выделить всё
import os
import json
from prettytable import PrettyTable
data = PrettyTable(["Col1", "Col2", "Col3"])
data.add_row(["test1", "test2", "test3"])
data.add_row(["test4", "test5", "test6"])
data.add_row(["test7", "test8", "test9"])
print(data)
data_string = data.get_string()
with open('/tmp/test.csv', w) as f:
f.write(data_string)
f.close
Подробнее здесь: https://stackoverflow.com/questions/725 ... ing-python
Мобильная версия