I'm trying to modify a VB-Expression saved in a cal-file:
dim out if [D19830701]=-9999 then out= [D19830501] else out= [D19830701] end if __esri_field_calculator_splitter__ out
with this simple script:
import os, sys o = open("D:\\Expressionnew.cal","a") #open for append for line in open("D:\\Expression.cal"): line = line.replace("D19830701","D19830801") o.write(line + "\n") o.close()
but all i get is this:
d i m o u t i f [ D 1 9 8 3 0 7 0 1 ] = - 9 9 9 9 t h e n o u t = [ D 1 9 8 3 0 5 0 1 ] e l s e o u t = [ D 1 9 8 3 0 7 0 1 ] e n d i f _ _ e s r i _ f i e l d _ c a l c u l a t o r _ s p l i t t e r _ _ o u t
No Replacement, the script just added "spaces" between every letter.
I want to use this Replacement-Script to fit the cal-file for several calculations i need to make.
Is there maybe a problem with the encoding (unicode?) when the script opens the file?
Maybe somebody has had the same problem ;)
or a nice workaround.
Thank you for reading.... Markus