Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to remove all characters after character in python?

Use str. split() to remove everything after a character in a string
a_string = "ab-cd"
split_string = a_string. split("-", 1) Split into "ab" and "cd"
substring = split_string[0]
print(substring)
 
PREVIOUS NEXT
Tagged: #How #remove #characters #character
ADD COMMENT
Topic
Name
8+5 =