How to Count Feature Classes in a Dataset?

Discussion created by Mick_C on Apr 26, 2011
Latest reply on Apr 27, 2011 by Mick_C

I'm trying to write a script to count the number of feature classes in a dataset so that I can delete any datasets that have a count of 0 feature classes.

this forms the last part of the script below:
import arcpy
from arcpy import env

# Sets the workspace
env.workspace = "L:\TEMP\test_Database_working.gdb"

# lists all feature classes in the workspace (geodatabase)
listFCs = arcpy.ListFeatureClasses("*")
# lists all feature datasets in the workspace (geodatabase)
listFDs = arcpy.ListDatasets("*")

# loops through the Feature Class list and deletes any with 0 features
for fc in listFCs:
    count1 = str(arcpy.GetCount_management(fc))
    if count1 == "0":

# loops through the Feature Dataset list and deletes any with 0 feature classes
# this part contains errors but shows what I'm attempting to acheive
for dataset in listFDs:
    count2 = str(arcpy.GetCount_management(dataset))
    if count2 == "0":

How can I fix the last part as 'GetCount_management' does not work?