I am trying to remove characters from a string but this Numeric value changes.
I'm passing in the string and the number of characters that should remain.
Below there are two ways I am trying this both doing the same thing... But the number of characters is hardcoded '75'
How do I replace the '75' with the variable 'characterLength' that is being passed into the def???
newmod2 = newmod1[: {characterLength} ]
def fModifyValue(processResults, charlength):
initialMod = str(processResults)
characterLength = charlength
newmod1 = initialMod.replace("u'", "")
newmod2 = (newmod1[:75] + '..') if len(newmod1) > 75 else newmod1
#OR
newmod2 = newmod1[:75]
return newmod2