打开大型数据集并用Java实例化数据的麻烦

时间:2019-05-25 18:01:25

标签: java arrays object arraylist

我试图从Java中的GIS数据文本文件中读取数据,实例化每行数据,然后对其中的数据进行排序,搜索和插入。我不断收到“在java.util.Scanner.next(Unknown Source)上说”的问题,并且无法解决此问题。我还想知道是否有建议使用其他方法来做到这一点。

我尝试使用数据类,在其中设置需要访问的所有变量,创建的getter和setter以及覆盖。然后,我创建了一个新的数据数组,并使用了if(input.hasNext()),在其中设置了每个变量,然后创建了GISData的新实例。

public class GISRunner {

    /**
     * @param args
     */
    public static void main(String[] args) throws FileNotFoundException {
        File file = new File("C:\\Users\\Toby\\Desktop\\GIS.txt");
        Scanner input = new Scanner(file);
        input.useDelimiter("||\n");

        GISData[] datas = new GISData[0];
        if(input.hasNext()) {
            int featureId = input.nextInt();
            String featureName = input.next();
            String featureClass = input.next();
            String stateCode = input.next();
            int stateId = input.nextInt();
            String countyName = input.next();
            int countyId = input.nextInt();
            String primaryLatitudeDMS = input.next();
            String primaryLongitudeDMS = input.next();
            double primaryLatitudeDecimal = Double.valueOf(input.next().substring(1));
            double primaryLongitudeDecimal = Double.valueOf(input.next().substring(1));
            String sourceLatitudeDMS = input.next();
            String sourceLongitudeDMS = input.next();
            double sourceLatitudeDecimal = Double.valueOf(input.next().substring(1));
            double sourceLongitudeDecimal = Double.valueOf(input.next().substring(1));
            int elevationMeters = input.nextInt();
            int elevationFeet = input.nextInt();
            String mapName = input.next();

            GISData newGISData = new GISData(featureId, featureName, featureClass, stateCode,
                    stateId, countyName, countyId, primaryLatitudeDMS, primaryLongitudeDMS, 
                    primaryLatitudeDecimal, primaryLongitudeDecimal, sourceLatitudeDMS, 
                    sourceLongitudeDMS, sourceLatitudeDecimal, sourceLongitudeDecimal, elevationMeters, 
                    elevationFeet, mapName);
            datas = addGISData(datas, newGISData);
        }
        for (GISData data : datas) {
            System.out.println(data);
        }
    }

    public static GISData[] addGISData(GISData[] datas, GISData dataToAdd) {
        GISData[] newGISData = new GISData[datas.length + 1 ];
        System.arraycopy(datas, 0, newGISData, 0, datas.length);
        newGISData[newGISData.length - 1 ] = dataToAdd;

        return newGISData;
    }

}


public class GISData implements Comparable<GISData> {
    public static enum SortByType {CountyName,
                                    FeatureName,
                                    PrimaryLatitude,
                                    PrimaryLongitude,
                                    SourceLatitude,
                                    SourceLongitude,
                                    ElevationFeet};

    private int featureId;
    private String featureName;
    private String featureClass;
    private String stateCode;
    private int stateId;
    private String countyName;
    private int countyId;
    private String primaryLatitudeDMS;
    private String primaryLongitudeDMS;
    private double primaryLatitudeDecimal;
    private double primaryLongitudeDecimal;
    private String sourceLatitudeDMS;
    private String sourceLongitudeDMS;
    private double sourceLatitudeDecimal;
    private double sourceLongitudeDecimal;
    private int elevationMeters;
    private int elevationFeet;
    private String mapName;
    private Date createdDate;
    private Date modifiedDate;
    private SortByType[] sortBy;


    public GISData(int featureId2, String featureName2, String featureClass2, String stateCode2, int stateId2,
            String countyName2, int countyId2, String primaryLatitudeDMS2, String primaryLongitudeDMS2,
            double primaryLatitudeDecimal2, double primaryLongitudeDecimal2, String sourceLatitudeDMS2, String sourceLongitudeDMS2, double sourceLatitudeDecimal2,
            double sourceLongitudeDecimal2, int elevationMeters2, int elevationFeet2, String mapName2) {
        featureId = featureId2;
        featureName2 = featureName;
        featureClass2 = featureClass;
        stateCode2 = stateCode;
        stateId2 = stateId;
        countyName2 = countyName;
        countyId2 = countyId;
        primaryLatitudeDMS2 = primaryLatitudeDMS;
        primaryLongitudeDMS2 = primaryLongitudeDMS;
        primaryLatitudeDecimal2 = primaryLatitudeDecimal;
        primaryLongitudeDecimal2 = primaryLongitudeDecimal;
        sourceLatitudeDMS2 = sourceLatitudeDMS;
        sourceLongitudeDMS2 = sourceLongitudeDMS;
        sourceLatitudeDecimal2 = sourceLatitudeDecimal;
        sourceLongitudeDecimal2 = sourceLongitudeDecimal;
        elevationMeters2 = elevationMeters;
        elevationFeet2 = elevationFeet;
        mapName2 = mapName;
    }
    /**
     * @return the featureId
     */
    public int getFeatureId() {
        return featureId;
    }
    /**
     * @param featureId the featureId to set
     */
    public void setFeatureId(int featureId) {
        this.featureId = featureId;
    }
    /**
     * @return the featureName
     */
    public String getFeatureName() {
        return featureName;
    }
    /**
     * @param featureName the featureName to set
     */
    public void setFeatureName(String featureName) {
        this.featureName = featureName;
    }
    /**
     * @return the featureClass
     */
    public String getFeatureClass() {
        return featureClass;
    }
    /**
     * @param featureClass the featureClass to set
     */
    public void setFeatureClass(String featureClass) {
        this.featureClass = featureClass;
    }
    /**
     * @return the stateCode
     */
    public String getStateCode() {
        return stateCode;
    }
    /**
     * @param stateCode the stateCode to set
     */
    public void setStateCode(String stateCode) {
        this.stateCode = stateCode;
    }
    /**
     * @return the stateId
     */
    public int getStateId() {
        return stateId;
    }
    /**
     * @param stateId the stateId to set
     */
    public void setStateId(int stateId) {
        this.stateId = stateId;
    }
    /**
     * @return the countyName
     */
    public String getCountyName() {
        return countyName;
    }
    /**
     * @param countyName the countyName to set
     */
    public void setCountyName(String countyName) {
        this.countyName = countyName;
    }
    /**
     * @return the countyId
     */
    public int getCountyId() {
        return countyId;
    }
    /**
     * @param countyId the countyId to set
     */
    public void setCountyId(int countyId) {
        this.countyId = countyId;
    }
    /**
     * @return the primaryLatitudeDMS
     */
    public String getPrimaryLatitudeDMS() {
        return primaryLatitudeDMS;
    }
    /**
     * @param primaryLatitudeDMS the primaryLatitudeDMS to set
     */
    public void setPrimaryLatitudeDMS(String primaryLatitudeDMS) {
        this.primaryLatitudeDMS = primaryLatitudeDMS;
    }
    /**
     * @return the primaryLongitudeDMS
     */
    public String getPrimaryLongitudeDMS() {
        return primaryLongitudeDMS;
    }
    /**
     * @param primaryLongitudeDMS the primaryLongitudeDMS to set
     */
    public void setPrimaryLongitudeDMS(String primaryLongitudeDMS) {
        this.primaryLongitudeDMS = primaryLongitudeDMS;
    }
    /**
     * @return the primaryLatitudeDecimal
     */
    public double getPrimaryLatitudeDecimal() {
        return primaryLatitudeDecimal;
    }
    /**
     * @param primaryLatitudeDecimal the primaryLatitudeDecimal to set
     */
    public void setPrimaryLatitudeDecimal(double primaryLatitudeDecimal) {
        this.primaryLatitudeDecimal = primaryLatitudeDecimal;
    }
    /**
     * @return the primaryLongitudeDecimal
     */
    public double getPrimaryLongitudeDecimal() {
        return primaryLongitudeDecimal;
    }
    /**
     * @param primaryLongitudeDecimal the primaryLongitudeDecimal to set
     */
    public void setPrimaryLongitudeDecimal(double primaryLongitudeDecimal) {
        this.primaryLongitudeDecimal = primaryLongitudeDecimal;
    }
    /**
     * @return the sourceLatitudeDMS
     */
    public String getSourceLatitudeDMS() {
        return sourceLatitudeDMS;
    }
    /**
     * @param sourceLatitudeDMS the sourceLatitudeDMS to set
     */
    public void setSourceLatitudeDMS(String sourceLatitudeDMS) {
        this.sourceLatitudeDMS = sourceLatitudeDMS;
    }
    /**
     * @return the sourceLongitudeDMS
     */
    public String getSourceLongitudeDMS() {
        return sourceLongitudeDMS;
    }
    /**
     * @param sourceLongitudeDMS the sourceLongitudeDMS to set
     */
    public void setSourceLongitudeDMS(String sourceLongitudeDMS) {
        this.sourceLongitudeDMS = sourceLongitudeDMS;
    }
    /**
     * @return the sourceLatitudeDecimal
     */
    public double getSourceLatitudeDecimal() {
        return sourceLatitudeDecimal;
    }
    /**
     * @param sourceLatitudeDecimal the sourceLatitudeDecimal to set
     */
    public void setSourceLatitudeDecimal(double sourceLatitudeDecimal) {
        this.sourceLatitudeDecimal = sourceLatitudeDecimal;
    }
    /**
     * @return the sourceLongitudeDecimal
     */
    public double getSourceLongitudeDecimal() {
        return sourceLongitudeDecimal;
    }
    /**
     * @param sourceLongitudeDecimal the sourceLongitudeDecimal to set
     */
    public void setSourceLongitudeDecimal(double sourceLongitudeDecimal) {
        this.sourceLongitudeDecimal = sourceLongitudeDecimal;
    }
    /**
     * @return the elevationMeters
     */
    public int getElevationMeters() {
        return elevationMeters;
    }
    /**
     * @param elevationMeters the elevationMeters to set
     */
    public void setElevationMeters(int elevationMeters) {
        this.elevationMeters = elevationMeters;
    }
    /**
     * @return the elevationFeet
     */
    public int getElevationFeet() {
        return elevationFeet;
    }
    /**
     * @param elevationFeet the elevationFeet to set
     */
    public void setElevationFeet(int elevationFeet) {
        this.elevationFeet = elevationFeet;
    }
    /**
     * @return the mapName
     */
    public String getMapName() {
        return mapName;
    }
    /**
     * @param mapName the mapName to set
     */
    public void setMapName(String mapName) {
        this.mapName = mapName;
    }
    /**
     * @return the createdDate
     */
    public Date getCreatedDate() {
        return createdDate;
    }
    /**
     * @param createdDate the createdDate to set
     */
    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }
    /**
     * @return the modifiedDate
     */
    public Date getModifiedDate() {
        return modifiedDate;
    }
    /**
     * @param modifiedDate the modifiedDate to set
     */
    public void setModifiedDate(Date modifiedDate) {
        this.modifiedDate = modifiedDate;
    }
    /**
     * @return the sortBy
     */
    public SortByType[] getSortBy() {
        return sortBy;
    }
    /**
     * @param sortBy the sortBy to set
     */
    public void setSortBy(SortByType[] sortBy) {
        this.sortBy = sortBy;
    }
    @Override
    public int compareTo(GISData o) {
        /**
         * Make sure to complete this section in such a way that the 
         * type of comparison can easily be changed to factor in the different 
         * types of comparisons you need to make. I've given you a mechanism 
         * in the class to essentially select the comparison type. You can use that 
         * or you could code different methods, call those methods from here 
         * and comment out the methods you won't use. It's up to you.
         */
        return 0;
    }
    @Override 
    public String toString() {
        return String.format("ID: %s\r\nName: %s\r\nClass: %s\r\n");
    }
}

我希望加载的每个数据实例的输出。尽管这是一个庞大的数据集,但我只是希望能够将数据加载到程序中。另外,如果有人对我可以编写的有效排序和搜索数据的方法有任何建议,我将不胜感激。

(我正在使用的数据集:https://s3.us-east-1.amazonaws.com/blackboard.learn.xythos.prod/5744b9beb8ccb/8090292?response-content-disposition=inline%3B%20filename%2A%3DUTF-8%27%27CA_Features_20190301.txt&response-content-type=text%2Fplain&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20190525T170332Z&X-Amz-SignedHeaders=host&X-Amz-Expires=21599&X-Amz-Credential=AKIAIL7WQYDOOHAZJGWQ%2F20190525%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=a0e4ce710ad5f5226b3f60544d897c7bd5cd1da59632e5248655b149ef56f7e3

1 个答案:

答案 0 :(得分:0)

Apache Commons CSV

我让Apache Commons CSV库完成读取文本文件的工作。 (注意:JavaDoc为here –主页上的链接已断开。)

我从CSVFormat.TDF格式定义开始,然后对其进行更改以期望使用VERTICAL BAR(竖线,|)而不是使用制表符作为分隔符。

我用enum命名了输入数据的所有字段。但这是可选的,您可以使用字符串名称。

请注意浮点类型double trading away accuracy的执行速度。如果要保持数字不变,请使用BigDecimal

通过使用对象而不是基元,我们可以使用null来显示输入缺少数据的位置。

我使用三元运算符测试NULL值。三元只是一个if-the-else语句,它使用以下语法折叠成一行:

result = test ? valueToUseIfTestIsTrue : valueToUseIfTestIsFalse ; 

示例:如果以米为单位的高程为空字符串,则记录为NULL。否则,将传入的字符串解析为Integer对象。

Integer ELEV_IN_M = record.get( FIELD.ELEV_IN_M ).isBlank() ? null : Integer.valueOf( record.get( FIELD.ELEV_IN_M ) );

String::isBlank方法是Java 11中的新方法。它测试空字符串或完全由空格字符组成的字符串。对于早期的Java,在Java 6及更高版本中,用String::isEmpty替换。您的数据似乎只有空字符串,没有空格,但是我没有验证这一观察。

跳过getter / setter方法。只需使用public成员变量,直到所有其他代码都起作用,并且您有特定的理由分层访问器方法即可。

为了更快地编写此演示代码,我只是按原样复制粘贴了数据文件的文件名,全部使用大写。我没有费心将每个规范Java更改为驼峰式。

这是一个完整的工作示例,在一个大类中,使用main方法进行演示。

package work.basil.example;

import org.apache.commons.csv.*;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.math.BigDecimal;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

public class Gis
{
    public enum FIELD
    {
        FEATURE_ID, FEATURE_NAME, FEATURE_CLASS, STATE_ALPHA, STATE_NUMERIC, COUNTY_NAME, COUNTY_NUMERIC, PRIMARY_LAT_DMS, PRIM_LONG_DMS, PRIM_LAT_DEC, PRIM_LONG_DEC, SOURCE_LAT_DMS, SOURCE_LONG_DMS, SOURCE_LAT_DEC, SOURCE_LONG_DEC, ELEV_IN_M, ELEV_IN_FT, MAP_NAME, DATE_CREATED, DATE_EDITED
    }

    public String FEATURE_NAME, FEATURE_CLASS, STATE_ALPHA, STATE_NUMERIC, COUNTY_NAME, COUNTY_NUMERIC, PRIMARY_LAT_DMS, PRIM_LONG_DMS, SOURCE_LAT_DMS, SOURCE_LONG_DMS, MAP_NAME;
    public Integer FEATURE_ID, ELEV_IN_M, ELEV_IN_FT;
    public BigDecimal PRIM_LAT_DEC, PRIM_LONG_DEC, SOURCE_LAT_DEC, SOURCE_LONG_DEC;
    public LocalDate DATE_CREATED, DATE_EDITED;

    // Constructor
    public Gis ( Integer FEATURE_ID , String FEATURE_NAME , String FEATURE_CLASS , String STATE_ALPHA , String STATE_NUMERIC , String COUNTY_NAME , String COUNTY_NUMERIC , String PRIMARY_LAT_DMS , String PRIM_LONG_DMS , BigDecimal PRIM_LAT_DEC , BigDecimal PRIM_LONG_DEC , String SOURCE_LAT_DMS , String SOURCE_LONG_DMS , BigDecimal SOURCE_LAT_DEC , BigDecimal SOURCE_LONG_DEC , Integer ELEV_IN_M , Integer ELEV_IN_FT , String MAP_NAME , LocalDate DATE_CREATED , LocalDate DATE_EDITED )
    {
        Objects.requireNonNull( FEATURE_ID ); // … and so on.
        this.FEATURE_ID = FEATURE_ID;
        this.FEATURE_NAME = FEATURE_NAME;
        this.FEATURE_CLASS = FEATURE_CLASS;
        this.STATE_ALPHA = STATE_ALPHA;
        this.STATE_NUMERIC = STATE_NUMERIC;
        this.COUNTY_NAME = COUNTY_NAME;
        this.COUNTY_NUMERIC = COUNTY_NUMERIC;
        this.PRIMARY_LAT_DMS = PRIMARY_LAT_DMS;
        this.PRIM_LONG_DMS = PRIM_LONG_DMS;
        this.PRIM_LAT_DEC = PRIM_LAT_DEC;
        this.PRIM_LONG_DEC = PRIM_LONG_DEC;
        this.SOURCE_LAT_DMS = SOURCE_LAT_DMS;
        this.SOURCE_LONG_DMS = SOURCE_LONG_DMS;
        this.SOURCE_LAT_DEC = SOURCE_LAT_DEC;
        this.SOURCE_LONG_DEC = SOURCE_LONG_DEC;
        this.ELEV_IN_M = ELEV_IN_M;
        this.ELEV_IN_FT = ELEV_IN_FT;
        this.MAP_NAME = MAP_NAME;
        this.DATE_CREATED = DATE_CREATED;
        this.DATE_EDITED = DATE_EDITED;
    }

    // -------|  Object  |-----------------------

    @Override
    public String toString ()
    {
        return new StringJoiner( " | " , Gis.class.getSimpleName() + "{ " , " }" )
                .add( "FEATURE_ID='" + this.FEATURE_ID + "'" )
                .add( "FEATURE_NAME='" + this.FEATURE_NAME + "'" )
                .toString();
    }

    // -------|  Parsing  |----------------------

    static public List < Gis > parseFile ( final String path )
    {
        ArrayList < Gis > list = new ArrayList <>();
        DateTimeFormatter f = DateTimeFormatter.ofPattern( "MM/dd/uuuu" );
        try
        {
            Reader reader = new FileReader( path );

            CSVFormat format = CSVFormat.TDF.withHeader( Gis.FIELD.class ).withFirstRecordAsHeader().withTrim().withDelimiter( '|' ); // Must pass a `char` to `withDelimiter` not a `String`, so use single-quote not double-quote.
            Iterable < CSVRecord > records = format.parse( reader );
            for ( CSVRecord record : records )
            {
                // FEATURE_ID|FEATURE_NAME|FEATURE_CLASS|STATE_ALPHA|STATE_NUMERIC|COUNTY_NAME|COUNTY_NUMERIC|PRIMARY_LAT_DMS|PRIM_LONG_DMS|PRIM_LAT_DEC|PRIM_LONG_DEC|SOURCE_LAT_DMS|SOURCE_LONG_DMS|SOURCE_LAT_DEC|SOURCE_LONG_DEC|ELEV_IN_M|ELEV_IN_FT|MAP_NAME|DATE_CREATED|DATE_EDITED

                Integer FEATURE_ID = Integer.valueOf( record.get( FIELD.FEATURE_ID ) );
                String FEATURE_NAME = record.get( FIELD.FEATURE_NAME );
                String FEATURE_CLASS = record.get( FIELD.FEATURE_CLASS );
                String STATE_ALPHA = record.get( FIELD.STATE_ALPHA );
                String STATE_NUMERIC = record.get( FIELD.STATE_NUMERIC );
                String COUNTY_NAME = record.get( FIELD.COUNTY_NAME );
                String COUNTY_NUMERIC = record.get( FIELD.COUNTY_NUMERIC );
                String PRIMARY_LAT_DMS = record.get( FIELD.PRIM_LONG_DMS );
                String PRIM_LONG_DMS = record.get( FIELD.PRIM_LONG_DMS );
                BigDecimal PRIM_LAT_DEC = record.get( FIELD.PRIM_LAT_DEC ).isBlank() ? null : new BigDecimal( record.get( FIELD.PRIM_LAT_DEC ) );
                BigDecimal PRIM_LONG_DEC = record.get( FIELD.PRIM_LONG_DEC ).isBlank() ? null : new BigDecimal( record.get( FIELD.PRIM_LONG_DEC ) );
                String SOURCE_LAT_DMS = record.get( FIELD.SOURCE_LAT_DMS );
                String SOURCE_LONG_DMS = record.get( FIELD.SOURCE_LONG_DMS );
                BigDecimal SOURCE_LAT_DEC = record.get( FIELD.SOURCE_LAT_DEC ).isBlank() ? null : new BigDecimal( record.get( FIELD.SOURCE_LAT_DEC ) );
                BigDecimal SOURCE_LONG_DEC = record.get( FIELD.SOURCE_LONG_DEC ).isBlank() ? null : new BigDecimal( record.get( FIELD.SOURCE_LONG_DEC ) );
                Integer ELEV_IN_M = record.get( FIELD.ELEV_IN_M ).isBlank() ? null : Integer.valueOf( record.get( FIELD.ELEV_IN_M ) );
                Integer ELEV_IN_FT = record.get( FIELD.ELEV_IN_FT ).isBlank() ? null : Integer.valueOf( record.get( FIELD.ELEV_IN_FT ) );
                String MAP_NAME = record.get( FIELD.MAP_NAME );
                LocalDate DATE_CREATED = record.get( FIELD.DATE_CREATED ).isBlank() ? null : LocalDate.parse( record.get( FIELD.DATE_CREATED ) , f );
                LocalDate DATE_EDITED = record.get( FIELD.DATE_EDITED ).isBlank() ? null : LocalDate.parse( record.get( FIELD.DATE_EDITED ) , f );

                Gis gis = new Gis( FEATURE_ID , FEATURE_NAME , FEATURE_CLASS , STATE_ALPHA , STATE_NUMERIC , COUNTY_NAME , COUNTY_NUMERIC , PRIMARY_LAT_DMS , PRIM_LONG_DMS , PRIM_LAT_DEC , PRIM_LONG_DEC , SOURCE_LAT_DMS , SOURCE_LONG_DMS , SOURCE_LAT_DEC , SOURCE_LONG_DEC , ELEV_IN_M , ELEV_IN_FT , MAP_NAME , DATE_CREATED , DATE_EDITED );
                list.add( gis );
            }
        } catch ( FileNotFoundException e )
        {
            e.printStackTrace();
        } catch ( IOException e )
        {
            e.printStackTrace();
        }
        list.trimToSize();
        return list;
    }

    // ---------|  Demo (psvm)  |------------------------------------------
    public static void main ( String[] args )
    {
        if ( false ) // Experiment on a small file, a subset of data. If that works, run the huge file.
        {
            String path = "/Users/basilbourque/gis-small.txt";
            List < Gis > list = Gis.parseFile( path );
            System.out.println( "list.size(): " + list.size() );
            System.out.println( "list: " + list );
        } else
        {
            String path = "/Users/basilbourque/gis.txt";
            List < Gis > list = Gis.parseFile( path );
            System.out.println( "list.size(): " + list.size() );
            System.out.println( "list.sublist( 0 , 10 ): " + list.subList( 0 , 10 ) );
            System.out.println( "list.sublist (last 10): " + list.subList( list.size()-10 ,list.size()) );
        }
    }
}

运行时。

  

list.size():122669

     

list.sublist(0,10):[Gis {FEATURE_ID ='2928'| FEATURE_NAME =“科波拉桥”},吉斯{FEATURE_ID ='6185'| FEATURE_NAME =“帝国国家野生动物保护区”},Gis {FEATURE_ID ='8164'| FEATURE_NAME ='Mohave Canyon'},Gis {FEATURE_ID ='8174'| FEATURE_NAME ='Mohave Valley'},吉斯{FEATURE_ID ='9144'| FEATURE_NAME ='Palo Verde Dam'},吉斯{FEATURE_ID ='9146'| FEATURE_NAME ='Palo Verde Intake'},Gis {FEATURE_ID ='9227'| FEATURE_NAME ='Parker Valley'},吉斯{FEATURE_ID ='12628'| FEATURE_NAME ='Topock Gorge'},Gis {FEATURE_ID ='14114'| FEATURE_NAME =“尤马主运河”},吉斯{FEATURE_ID ='22751'| FEATURE_NAME ='科波拉国家野生动物保护区'}]

     

list.sublist(最后10个):[Gis {FEATURE_ID ='27833610'| FEATURE_NAME ='海军陆战队招募站邮局'},Gis {FEATURE_ID ='27833611'| FEATURE_NAME ='MCAS Miramar Post Office'},Gis {FEATURE_ID ='27833612'| FEATURE_NAME ='麦考伊山邮局'},Gis {FEATURE_ID ='27833613'| FEATURE_NAME ='NAS北岛邮局'},Gis {FEATURE_ID ='27833614'| FEATURE_NAME ='Pala Post Office'},Gis {FEATURE_ID ='27833615'| FEATURE_NAME ='Pinon Hills邮局'},Gis {FEATURE_ID ='27833616'| FEATURE_NAME ='Yermo Post Office'},Gis {FEATURE_ID ='27833617'| FEATURE_NAME ='联邦科维纳邮局'},Gis {FEATURE_ID ='27833618'| FEATURE_NAME ='蒙塔尔沃邮局'},Gis {FEATURE_ID ='27833619'| FEATURE_NAME ='比佛利山庄邮局'}

在实际工作中,我会将解析的内容移到其自己的类中,保留Gis类仅用于数据验证和存储。