ถอดปลั๊กอินสำหรับไพธอน

รหัสตัวอย่าง

22
0

ถอดเสื้อผ้าอยู่ในปลั๊กอินสำหรับไพธอน

txt = "     banana     "
x = txt.strip()
#x will be "banana"
21
0

ถอดเสื้อผ้าอยู่ในปลั๊กอินสำหรับไพธอน

txt = "     banana     "
x = txt.strip()
#x will be "banana"
14
0

ถอดปลั๊กอินสำหรับไพธอน

# removes outside whitespace/characters
'  hey  '.strip()     # "hey"
'  hey  '.lstrip()    # "hey  "
'  hey  '.rstrip()    # "  hey"
'_.hey__'.strip('._') # "hey"
13
0

ถอดปลั๊กอินสำหรับไพธอน

# removes outside whitespace/characters
'  hey  '.strip()     # "hey"
'  hey  '.lstrip()    # "hey  "
'  hey  '.rstrip()    # "  hey"
'_.hey__'.strip('._') # "hey"
12
0

ปลั๊กอินสำหรับไพธอนถอดเสื้อผ้าตัวอักษร

# Python3 program to demonstrate the use of 
# strip() method   
  
string = " python strip method test " 
  
# prints the string without stripping 
print(string)  
  
# prints the string by removing leading and trailing whitespaces 
print(string.strip())    
  
# prints the string by removing strip 
print(string.strip(' strip')) 
Output:
 python strip method test 
python strip method test
python method test
6
0

ถอดเสื้อผ้า()

txt = ",,,,,rrttgg.....banana....rrr"
x = txt.strip(",.grt")
#outputs banana
print(x)
1
0

ปลั๊กอินสำหรับไพธอนเธอ()

a = "  smurf   "

a = a.strip()
#remove space at begining and end of string
print(a)
#smurf
0
0

.ถอดเสื้อผ้า()เป็นภาษาไพธอน

string = '  xoxo love xoxo   '

# Leading and trailing whitespaces are removed
print(string.strip())

# All <whitespace>,x,o,e characters in the left
# and right of string are removed
print(string.strip(' xoe'))

# Argument doesn't contain space
# No characters are removed.
print(string.strip('stx'))

string = 'android is awesome'
print(string.strip('an'))

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังหน้ากับตัวอย่างอยู่ในหมวดหมู่