Defining features in a list

2012-09-07 Thread M Whitman
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 
print WS_Hyd
NameError: name 'WS_Hyd' is not defined
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Defining features in a list

2012-09-07 Thread M Whitman
Dave- By features I was refering to items in the list.  For background the 
arcpy module is used for geoprocessing of geographic information.  I'm using my 
script to get totals for features in a dataset that I receive on a regular 
basis- for example total number of hydrants, total number of hydrants with null 
or missing attributes, and total number of hydrants with outlining attributes.

I am experienced particularly with the arcpy module and I am trying deligently 
to become more experienced with Python in general.  My goal is to fetch values 
by name and then print output by name. print WS_Hyd and then see "484".   I 
have some experience with class definition but a dictionary might be the way to 
go.  I was understanding the response of the Arcpy module but hadn't understood 
why the list wasn't being defined in my previous loop statement.  I appreciate 
the response.  I will look into dict if you have a class definition suggestion 
I will run with that.  Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list