“Python Trim String a longitud” Código de respuesta

Python Trim String a longitud

mystr="I am too long I should only be 10 characters.";
mystr = mystr[:10]
Friendly Hawk

Corte de espacios en la pitón de cuerda

a = "      yo!      "
b = a.strip() # this will remove the white spaces that are leading and trailing
Super Stoat

Recorte la cadena a la longitud máxima Python

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
Yog

Respuestas similares a “Python Trim String a longitud”

Preguntas similares a “Python Trim String a longitud”

Más respuestas relacionadas con “Python Trim String a longitud” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código