首页 > 文档 > saveTable()保存表
2017
08-02

saveTable()保存表

Name

saveTable()保存表

   

Examples

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

Description

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.

将表对象的内容写入文件。默认情况下, 此文件保存到草绘的文件夹中。通过从草绘菜单中选择显示草图文件夹打开此文件夹。

 

或者, 该文件可以通过使用绝对路径 ( unix linux 上启动的东西, windows 上的驱动器号) 保存到计算机上的任何位置。

 

处理 api 加载和保存的所有文件都使用 UTF-8 编码。

Syntax

saveTable(table, filename)

saveTable(table, filename, options)

Parameters

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”

Returns

boolean

Related

Table
loadTable()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。