Someone else just asked me the same thing. How about this one-liner?
gp.CalculateField_management(fc,"name","string.capwords(!name!)","PYTHON","import string")
(You have to import the string module because it's not a built-in string function.)
There may be other exceptions such as dashes and apostropies that need Uppercasing such as O'Brien or other Double-Banger names. In this case use a cursor and regular expression
import arcgisscripting
import string
import re
gp = arcgisscripting.create(9.3)
# settings
fc = "d:/work/test.gdb/trail"
# simple way but inadequate
gp.CalculateField_management(fc,"name","string.capwords(!name!)","PYTHON","import string")
print gp.GetMessages()
# Handle imbedded quotes like O'Brien
quoteabbrev = re.compile("'[a-z]")
# just as fast as a calculate and we can trap exceptions, errors
cur = gp.UpdateCursor(fc)
row = cur.next()
while row:
x = string.capwords(row.name)
if quoteabbrev.search(x):
print x,name
name = quoteabbrev.sub(quoteabbrev.search(x).group(0).upper(),x)
cur.updateRow(row)
row = cur.next()
del row,cur
print gp.GetMessages()
I never got the VB equivalent ProperCase to work in a script.
I believe that the benevolent dictator for life is recommending that you not use the string module. You can now use the string methods to accomplish most of what I believe you are trying to do, for instancecolumnValue = "hello world"
columnValue.split(" ")
returnValue = columnValue[0].capitalize() + " " columnValue[1].capitalize()
print returnValue
>>>"Hello World"
Also it looks like you're trying to pass your entire coded returnvalue as a string:gp.CalculateField_management(fc,"name","string.cap words(!name!)","PYTHON","import string")
Try it this way:returnValue = columnValue[0].capitalize() + " " columnValue[1].capitalize()
gp.CalculateField_management(fc, "field", returnValue, "PYTHON")
My only other recommendation would be to NOT let the geoprocessor interpret code for you you aside from SQL if you can help it. Let the native python do as much of the work for you as possible.