List of fields

I need to check if a feature class includes a field called 'unwanted_field' and then delete it. I've been trying to accomplish that with an if statement on a field list gained by the arcpy.ListFields tool, but with no success. If I type in my 10.2.1 ArcMap Python window next code:

You are doing nothing wrong, it just is printing the location on the harddrive of each field, instead of the name. If you need to retrieve the actual name of the field, you need to use the .baseName or .aliasName method on each field.

Hi Gaspar, what you're getting is a list of field objects, which, when printed out, looks like gibberish. As jamesfreddyc wrote above, you need to access the name property of each field object. You can condense this by using list comprehension:

if "fieldname" in [f.name for f in arcpy.ListFields(featureclass)]:
#do something