saveTable()

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

saveTable()

示例
 Table table;



void setup()
{  
 table = new Table();



table.addColumn("id");


table.addColumn("species");


table.addColumn("name");



TableRow newRow = table.addRow();


newRow.setInt("id", table.getRowCount() - 1);


newRow.setString("species", "Panthera leo");


newRow.setString("name", "Lion");



saveTable(table, "data/new.csv");


  }  // Sketch saves the following to a file called "new.csv": // id,species,name // 0,Panthera leo,Lion 
描述 Writes the contents of a Table object to a file. By default, this file is saved to the sketch’s folder. This folder is opened by selecting “Show Sketch Folder” from the “Sketch” menu.

Alternatively, the file can be saved to any location on the computer by using an absolute path (something that starts with / on Unix and Linux, or a drive letter on Windows).

All files loaded and saved by the Processing API use UTF-8 encoding.

语法
saveTable(table, filename) saveTable(table, filename, options)
参数
table Table: the Table object to save to a file
filename String: the filename to which the Table should be saved
options String: can be one of “tsv”, “csv”, “bin”, or “html”
返回值 boolean
相关 Table
loadTable()

Updated on October 2, 2018 05:02:07pm EDT

saveTable()