Remove everything after a character in a string
Using str.split(sep, maxsplit)
# maxsplit=1 to split at first occurence
a_string = "ab-cd"
split_string = a_string.split("-", 1)
substring = split_string[0]
print(substring)
ab