i have a input and i want to split the text to get the desired output i have used txt.split(":")[-1]
but it's not solving my issue.Need help new to python coding.
input:End Date: 10-09-2020 10:00 AM
Desired output: 10-09-2020 10:00 AM
i have a input and i want to split the text to get the desired output i have used txt.split(":")[-1]
but it's not solving my issue.Need help new to python coding.
input:End Date: 10-09-2020 10:00 AM
Desired output: 10-09-2020 10:00 AM
try:
input = "End Date: 10-09-2020 10:00 AM"
matcher = "End Date: " # get a constant identifier to look for
# now we want to slice the string in such way that leaves only the part
# after the matcher. So we find the first occurence of matcher and then
# add it's length to see where is the end of the matcher. then we
# simply take the remaining string
desired = input[input.find(matcher)+len(matcher):]
txt.split("End Date:")[-1]
it will solve the issue