4

In this attribute table, "DISTANCE" field name created with this python expression (in Field Claculator):

str( !Shape_Leng! ) + !field_name!

enter image description here

Everything works fine.

But I seek a way to get on 1 number of decimal place and not 9 places as in the result. In the Field Properties the option to change is blocked.

enter image description here

enter image description here

whyzar
  • 12,053
  • 23
  • 38
  • 72
newGIS
  • 4,062
  • 4
  • 41
  • 92

1 Answers1

10

'%.1f %s' % (!SHAPE_Leng!, !field_name!)

%.1f represents float with 1 decimal digit. Replace it with %.2f to get 2 digits and so on. %s is a string.

Or you can use format()

String Formatting Operations on Python site

Serge Norin
  • 862
  • 7
  • 14