PT1 = 'HELLO'
FieldMapString = '''
PIN "PIN" true true false 13 Text 0 0 ,First,#, {0}, Pin,-1,-1;
ACRES "ACRES" true true false 4 Double 0 0 ,First,#, {0}, ACRES,-1,-1;
Instrument "Instrument" true true false 10 Text 0 0 ,First,#, {0}, Instrument,-1,-1;
SiteAddres "SiteAddres" true true false 106 Text 0 0 ,First,#, {0}, SiteAddres,-1,-1;
SiteCity "SiteCity" true true false 32 Text 0 0 ,First,#, {0}, SiteCity,-1,-1;
SiteZip "SiteZip" true true false 10 Text 0 0 ,First,#, {0}, SiteZip,-1,-1;
SubName "SubName" true true false 20 Text 0 0 ,First,#, {0}, SubName,-1,-1;
'''
print(FieldMapString.format(PT1))
def Layers15(PT1, FieldMapString):
"""pass the variable and the constant into
the function
"""
fieldmappings = arcpy.FieldMappings()
fieldmappings.loadFromString(FieldMapString)
return fieldmappings
don't know about the speed thing, but that ugly string in a function surely had to go.