Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28687

Defining features in a list

Newsgroups comp.lang.python
Date 2012-09-07 06:42 -0700
Message-ID <e7c07576-677f-4230-9abc-34693e68fa7b@googlegroups.com> (permalink)
Subject Defining features in a list
From M Whitman <mgwhitman@gmail.com>

Show all headers | View raw


Good Morning,

I have been recently trying to define all of the features in a list but have been running into errors.  I would like to define the features similar to the following print statement.  Any advice would be appreciated.  I'm trying to transition my output from a text file to excel and if I can loop through my lists and define them that transition will be cleaner.

Many Thanks,

-Matt

#Author: MGW
#2012 
import os, datetime, sys, arcpy, xlrd
from arcpy import env
submission = "Rev.mdb"
env.workspace = "C:/temp/"+submission+"/Water"

#Get Submission totals
fclist = sorted(arcpy.ListFeatureClasses("*"))
for fc in fclist:
    print fc+"="+str(arcpy.GetCount_management(fc).getOutput(0))

print "Complete"
raw_input("Press ENTER to close this window") 

Output Generated
WATER_Net_Junctions=312
WS_Hyd=484
WS_Mains=2752
WS_Node=4722
WS_Vlvs=1078
WS_WatLats=3661
WS_WatMtrs=3662
WTRPLANTS_points=0
WTRPUMPSTA_points=0
WTRTANKS=0
WTR_ARV=10
WTR_MISC=0
Complete
Press ENTER to close this window

#Get Submission totals
fclist = sorted(arcpy.ListFeatureClasses("*"))
for fc in fclist:
    fc=str(arcpy.GetCount_management(fc).getOutput(0))
    #TEST
    print WS_Hyd
   
        
print "Complete"
raw_input("Press ENTER to close this window") 

Output Generated
Traceback (most recent call last):
  File "C:\Documents and Settings\mattheww\Desktop\Copy of QAQCexce_2.py", line 14, in <module>
    print WS_Hyd
NameError: name 'WS_Hyd' is not defined

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Defining features in a list M Whitman <mgwhitman@gmail.com> - 2012-09-07 06:42 -0700
  Re: Defining features in a list Dave Angel <d@davea.name> - 2012-09-07 10:35 -0400
  Re: Defining features in a list M Whitman <mgwhitman@gmail.com> - 2012-09-07 08:21 -0700
    Re: Defining features in a list Dave Angel <d@davea.name> - 2012-09-07 11:55 -0400
  Re: Defining features in a list Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-09-07 17:47 +0200
  Re: Defining features in a list Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-07 15:29 -0400

csiph-web