Convert Table To CSV File (Roads and Highways)

许可等级:BasicStandardAdvanced

摘要

Converts a table to a CSV file.

用法

语法

ConvertTableToCsvFile_roads (in_table, out_csv_file, {in_delimiter})
参数说明数据类型
in_table

A geodatabase table, feature class, shapefile, .dbf file, or table view to convert.

Table View
out_csv_file

Location and file name of the output CSV file.

file
in_delimiter
[in_delimiter,...]
(可选)

Sets the delimiter for the output CSV file (optional). The pipe delimiter is the default choice.

  • PIPEThe fields are separated by a pipe, for example, Field1 | Field2. This is the default.
  • COMMAThe fields are separated by a comma, for example, Field1, Field2.
String

代码实例

ConvertTableToCsvFile example (in-line)

The following Python window script demonstrates how to use the ConvertTabletoCSV function in the immediate mode.

# tool variables
in_table="SpeedLimit"
out_csv_file="SpeedLimit_Converted"
in_delimiter="COMMA"

# set current workspace
arcpy.env.workspace="C:/Transportation.gdb"

# Process: Convert Table To CSV File
arcpy.ConvertTableToCsvFile_roads("SpeedLimit", "SpeedLimit_Converted", "COMMA")
ConvertTableToCsvFile example (Stand Alone script)

The following Python window script demonstrates how to use the ConvertTabletoCSV function in a stand-alone python script.

# Name: TableToCSV.py
# Description: Converts a table to a CSV file. 
# Requires: Esri Roads and Highways Solution

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("Highways")

# Process: Convert Table To CSV File
arcpy.ConvertTableToCsvFile_roads(r"C:\Transportation.gdb\SpeedLimit", r"C:\Data\SpeedLimit_Coverted", "COMMA")

环境

相关主题

许可信息

ArcGIS for Desktop Basic: 需要 Roads and Highways
ArcGIS for Desktop Standard: 需要 Roads and Highways
ArcGIS for Desktop Advanced: 需要 Roads and Highways
4/27/2014