“Função de tira de python” Respostas de código

O que é R Strip Function in Python

#!/usr/bin/python

str = "     this is string example....wow!!!     ";
print str.rstrip()
str = "88888888this is string example....wow!!!8888888";
print str.rstrip('8')

#the answer

#this is string example....wow!!!
#88888888this is string example....wow!!!
Poor Peccary

Função de tira de python

name = " softhunt.net "

print(name)

print(name.strip())
Outrageous Ostrich

string python: .strip ()

# Мөрний эхэн ба төгсгөлийн тэмдэгтүүдийг арилгахын тулд .strip() аргыг ашиглаж болно.
# Мөрийн аргументыг арга руу дамжуулж, арилгах тэмдэгтүүдийн багцыг зааж өгч болно.
# Аргын аргумент байхгүй бол хоосон зай арилна.

text1 = '   apples and oranges   '
text1.strip()       # => 'apples and oranges'
 
text2 = '...+...lemons and limes...-...'
 
# Here we strip just the "." characters
text2.strip('.')    # => '+...lemons and limes...-'
 
# Here we strip both "." and "+" characters
text2.strip('.+')   # => 'lemons and limes...-'
 
# Here we strip ".", "+", and "-" characters
text2.strip('.+-')  # => 'lemons and limes'
Puzzled Porcupine

Exemplo de função de tira de python

name = 'softhunt.net'
print(name)

strip_string = 'net'

print(name.strip(strip_string))
Outrageous Ostrich

Exemplo simples de função de tira de python

string = "softhunt.net"

print(string)

print(string.strip())

print(string.strip('softhunt'))
Outrageous Ostrich

Respostas semelhantes a “Função de tira de python”

Perguntas semelhantes a “Função de tira de python”

Mais respostas relacionadas para “Função de tira de python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código