Answers for "strip everything after character in python"

1

drop all characters after a character in python

sep = '...'
stripped = text.split(sep, 1)[0]
Posted by: Guest on February-23-2021
12

python strip characters

# 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
Posted by: Guest on April-07-2020

Code answers related to "strip everything after character in python"

Python Answers by Framework

Browse Popular Code Answers by Language