“Python Strip Newline z String” Kod odpowiedzi

Python Usuwanie \ n z ciągu

line = line.strip('\n')
line = line.strip('\t')
Awful Albatross

Python Strip Newline z String

a_string = a_string.rstrip("\n")
Faithful Flamingo

Python Jak usunąć n z ciągu

mylist = []
# Assuming that you have loaded data into a lines variable. 
for line in lines:
    mylist.append(line.strip().split('\t')
Fancy Fly

Za pomocą metody Strip () w celu usunięcia nowej postaci z łańcucha

# strip() method to remove newline characters from a string
text= "\n Welcome to Python Programming \n"
print(text.strip())
Gorgeous Gazelle

Odpowiedzi podobne do “Python Strip Newline z String”

Pytania podobne do “Python Strip Newline z String”

Więcej pokrewnych odpowiedzi na “Python Strip Newline z String” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu