CSV Output

For easy importing into spreadsheet applications, the versuchung package offers means to export data to CSV.

class versuchung.files.CSV_File(default_filename='', **csv_args)[source]

Can be used as: input parameter and output parameter

It is a normal File but the content of the file is interpreted as a csv file. It is parsed before the value is exposed to the user. And formatted before the content is written to disk.

Internally the csv is used, so all arguments to csv.reader and csv.writer can be given in csv_args.


Append a row to the csv file

It is just a shorthand for

>>> csv_file.value.append([1,2,3])
Parameters:row (list.) – row to append

Flush the cached content of the file to disk

Returns:string – path to the file/directory

Other than a normal CSV_File the value of a CSV_File is a list of lists, which represents the structure of the csv file. This value can be manipulated by the user.

>>> CSV_File("csv_output").value
[["1", "2", "3"]]