Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i'm traying to implent python string translate function at field calculatore in order to fix hebrew imported from cad. here is the code -

def Ttxt (RefName):
  from string import maketrans   
  intab = "asdfghjkl"
  outtab = "שדגכעיחלך"
  return trantab = maketrans(intab, outtab)

Ttxt( !RefName! )

Any sugestion about how to right this function ?

share|improve this question
What kind of software do you use? It is not obvious from question what is field calculator. – drnextgis Jul 17 '12 at 8:21

Judging from the examples on the site you would need something like this (untested):

def Ttxt (RefName):
  from string import maketrans   
  intab = "שדגכעיחלך"
  outtab = "asdfghjkl"
  trantab = maketrans(intab, outtab)

  return RefName.translate(trantab)
share|improve this answer
now i get this error messege: 000539 'return' outside function (<string>, line 6) – Alex Jul 17 '12 at 10:17
You haven't got your function formatted correctly – Nathan W Jul 17 '12 at 10:35
def Ttxt (RefName): import string from string import maketrans intab = "asdfghjkl" outtab = "שדגכעיחלך" transtab = string.maketrans(intab, outtab) return RefName.translate(transtab) and now 000989 unexspected indent (line 4) – Alex Jul 17 '12 at 10:59
posting Python in the comments isn't going to help because Python uses white space to work out code blocks. Maybe read up on a bit of Python first. – Nathan W Jul 17 '12 at 11:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.