arcpy.CalculateField_management(myFC,"NEW_FIELD","!OLD_FIELD![0] + !OLD_FIELD![len(!OLD_FIELD!)/2]","PYTHON_9.3","")
"Field calculator expresion might look like:".upper()
>>> text = ['{\fArial|b0|i0|c0|p34;14.50m}', '{\fArial|b0|i0|c0|p34;\L0.0203 ha}', '{\fArial|b0|i0|c0|p34;161° 34}', '{\fArial|b0|i0|c0|p34;93° 10}'] >>> for anno in text: anno.split(';')[1] '14.50m}' '\\L0.0203 ha}' '161\xb0 34}' '93\xb0 10}' >>>
>>> for anno in text: anno.split(';')[1][0:-1] '14.50m' '\\L0.0203 ha' '161\xb0 34' '93\xb0 10' >>>
>>> text = '{\x0cArial|b0|i0|c0|p34;14.50m}' >>> text.split(';')[1][0:-1] '14.50m' >>>
import re def remove_codes(code_string): # Get rid of enclosed text, ie {\instruction;Text to keep} replaced_sequences = re.sub(r"{\\[^;]+;([^}]*)}", r"\1", code_string) # Get rid of standalone \font|22pt; like sequences new_string = re.sub(r"\\[^;]+;", "", replaced_sequences) return new_string
>>> remove_codes(r"\pt16.25;{\fArial|b0|i0|c0|p34;15.00m}") '15.00m'
arcpy.CalculateField_management("Annos","TEXTS","!TEXTSTRING!.remove_codes","PYTHON_9.3","") Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 3128, in CalculateField raise e ExecuteError: ERROR 000539: Error running expression: "{\fArial|b0|i0|c0|p34;C - 40}".remove_codes Traceback (most recent call last): File "<expression>", line 1, in <module> AttributeError: 'str' object has no attribute 'remove_codes' Failed to execute (CalculateField).
Please how can i handle the issue of schema Lock? This schema lock issue is really getting on my nerves.
import os buildings = r"C:\arcgisserver\python\buildings.bat" mapping = r"C:\arcgisserver\python\mapping.bat" MRs = r"C:\arcgisserver\python\MRs.bat" finish = r"C:\arcgisserver\python\finish.bat" os.system(mapping) os.system(buildings) os.system(MRs) os.system(finish)
cd C:\Python27\ArcGIS10.1 Python C:\arcgisserver\python\buildings.py Exit
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.