string trim python untuk panjang
mystr="I am too long I should only be 10 characters.";
mystr = mystr[:10]
Friendly Hawk
mystr="I am too long I should only be 10 characters.";
mystr = mystr[:10]
a = " yo! "
b = a.strip() # this will remove the white spaces that are leading and trailing
length=75
info="sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trimsting you want to trimsting you want to trimsting you want to trimsting you want to trimsting you want to trimsting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trim sting you want to trimsting you want to trim sting you want to trim sting you want to trim sting you want to trim"
info = (data[:length] + '..') if len(data) > length else data