此为 Mathematica 8 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.2)

List

Column of numbers or strings.
Stores a list of numbers or strings as lines.
Plain text format.
Is essentially a single-column version of the "Table" format.
  • Import and Export provide various data conversion and formatting options for storing lists of numbers or strings.
  • Import automatically recognizes common number formats, including C and Fortran notations.
  • Numbers without decimal points are imported as integers.
  • Import imports a text file, returning each line as a string or a number.
  • Export writes any list as a column of numbers or strings.
  • Import["file", "List"] returns a list of strings or numbers, each representing a line of file.
  • Export["file", list, "List"] exports list as a column, writing the CForm of each element as a separate line.
  • Import imports the specified element from a List file.
  • Import imports multiple elements.
  • The format must be explicitly given.
  • Export creates a List file by treating expr as specifying element elem.
  • Export treats each as specifying the corresponding .
  • Export exports expr with the specified option elements taken to have the specified values.
  • Export uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties and settings
  • Data representation elements:
"Data"list of numbers or strings, each representing a line
"Grid"list data as a Grid object
AlignmentNonehow data is aligned within table columns
CharacterEncoding"UTF8"raw character encoding used in the file
CharacterEncoding"ASCII"raw character encoding used in the file
"EmptyField"""how to represent empty fields
"CurrencyTokens"{{"$", "£", "¥", "€"}, {"c", "¢", "p", "F"}}currency units to be skipped when importing numerical values
"DateStringFormat"Nonedate format, given as a DateString specification
"IgnoreEmptyLines"Falsewhether to ignore empty lines
"LineSeparators"{"\r\n","\n","\r"}string tokens taken to separate list elements
"Numeric"Truewhether to import data fields as numbers if possible
"NumberPoint""."string to use for a decimal point
"NumberSigns"{"-","+"}strings to use for signs of negative and positive numbers
"HeaderLines"0number of lines to skip at the beginning of the file
  • Import converts table entries formatted as specified by the option to a DateList representation of the form .
  • Empty lines and lines containing only whitespace characters are converted to an empty string by default. With set to True, Import will skip empty lines.
  • With False, numbers will be imported as strings in the form they appear in the file.
  • All common conventions for the encoding of newline characters are recognized with the default setting of .
Import a text file as a list of strings:
Import converts records to integers or reals if possible:
Currency symbols are automatically omitted when importing as a List:
Export a list of numbers using the List format:
Import a text file as a list of strings:
In[1]:=
Click for copyable input
Out[1]=
 
Import converts records to integers or reals if possible:
In[1]:=
Click for copyable input
Out[1]=
 
Currency symbols are automatically omitted when importing as a List:
In[1]:=
Click for copyable input
Out[1]=
 
Export a list of numbers using the List format:
In[1]:=
Click for copyable input
Out[1]=