Problem getting last characters until find "" character?

Question:

Hi i don’t know how to do this, in this example i want to get all the last characters until i find the "" character, usually in this way works but it seems that typing "" inside the split function doesn’t work and the program gives me an error. So how to get all the last characters until i find the "" starting from the end?

string = 'C:usercomputermyfile.txt'
a = string.split('')
Asked By: Forty966996

||

Answers:

Escape your string with ”:

string = 'C:\user\computer\myfile.txt'
a = string.split('\')
print(a)

# Output
['C:', 'user', 'computer', 'myfile.txt']
Answered By: Corralien
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.