string and numbers

712
8
07-16-2018 07:17 PM
ArmandoFreites
New Contributor III

In a field string I need put 2 other field but format number.

FOR EXAMPLE I NEED:   NORTH: 25812,25  EAST: 25857.26

I PUT in python:  " NORTH:" + !POINT_Y!+ "EST:"+ !POINT_X!   ,  but ins´t correct

my field es a string type

0 Kudos
8 Replies
DanPatterson_Retired
MVP Emeritus
" NORTH: {}  EST: {}".format(!POINT_Y!, !POINT_X!)

should do it

ArmandoFreites
New Contributor III

Thankkssss.  very useful

0 Kudos
DanPatterson_Retired
MVP Emeritus

Armando. please mark the answer correct if it worked so others know a solution was found.

0 Kudos
ArmandoFreites
New Contributor III

Hello Dan. i find this solution 

Very good.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Yes that can still be done.  But the 'format' method removes the need to perform conversion to string and the concatenation with the +.

The utility of this method will become more apparent when you have to use python 3 in ArcGIS Pro (soon )

ArmandoFreites
New Contributor III

Ok Ok i need write more about Format(). But thanks a lot, it´s very important your job.

0 Kudos
DanPatterson_Retired
MVP Emeritus

/blogs/dan_patterson/2016/03/01/basic-fancy-formats 

my blog is full of stuff  

it will probably keep you busy for some time

ArmandoFreites
New Contributor III

You don´t like make videos????. Are excellent to for this cases.

0 Kudos