Hi,
I have a string field in attribute table with values like:
125.15.
1.589.
I need to replace the last character "." by "1" in the field calculator with python parser, so my values will be like:
125.151
1.5891
How can I do this?
Thanks
like this (python parser)
<SPAN class="comment token"># ---- example ----</SPAN> a <SPAN class="operator token">=</SPAN> <SPAN class="string token">'125.15.'</SPAN> <SPAN class="string token">"{}1"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>a<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="string token">'125.151'</SPAN> <SPAN class="comment token"># ---- for the field calculator ----</SPAN> <SPAN class="string token">"{}1"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>!YourFieldNameHere!<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Perfect!!
Thanks a lot Dan
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.