I need a piece of code that takes a string like this string1 = "aaa/bbb/ccc/dd" and extracts a string containting the character after the last "/" So for this example the result would be "dd" like this: for i=0; string1.right(i) != '/'; i++ result = string1.mid(i, string1.length()) but in python.