Hi,
I have a simple script using CalculateFields geoprocessing tool. As part of my script, I build an expression in a loop for fields to calculate. However, it is not working...
If I use hard-coded field names and expression for calculation, it works.
Why my 'expression' string variable is not working? It is exactly the same as the hard-coded string...
arcpy.management.CalculateFields(in_table=fc, expression_type="PYTHON3", fields=[["Detached", "!Detached!*!Ratio!", ""], ["Total", "!Total!*!Ratio!", ""]])[0]
arcpy.management.CalculateFields(in_table=fc, expression_type="PYTHON3", fields=expression)[0]