Rounding, concatenating, and stacking labels

185
1
12-26-2019 01:44 PM
ChrisKelley
New Contributor III

So this is the simplest question ever, maybe.  I am trying to move from using #vbscript to #Python in labeling expressions.

Can you help me translate this simple vbscript line into python.

round([Acres],1) & vbnewline & [SqMi]

I can concatenate and stack lines in python. I can round in python. I can't do both at the same time though.  Python newbie.

0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Chris Kelley ,

It is a good thing to move away from VBScript since it is no longer support in ArcGIS (and by Microsoft). In Python you would probably want to use something like this:

round(!Acres!,1) + "\n" + !SqMi!

Although it is a very good thing to start to learn Python, it might not be the best option for labeling. When you want this to work across the platform you might want to check Arcade expression language: ArcGIS Arcade | ArcGIS for Developers  This will be supported in ArcGIS Pro (Desktop), Web maps in AGOL and Enterprise and mobile apps.