Is it possible to manipulate a variable, for example:
file = "/Python/work.txt"
to just list work.txt, without /Python? excluding everything on the left of the "/"?
Thank you
Is it possible to manipulate a variable, for example:
file = "/Python/work.txt"
to just list work.txt, without /Python? excluding everything on the left of the "/"?
Thank you
Of course! Simply do this:
file = "/Python/work.txt"
excluded = file.split("/")[-1]
This would return "work.txt" in the excluded variable.