Timeline for How to remove a path prefix in python?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 15, 2017 at 15:09 | comment | added | nn0p | This doesn't work with multiple folders of same names. | |
Jan 16, 2014 at 9:23 | vote | accept | Natim | ||
Apr 12, 2018 at 7:41 | |||||
Jan 1, 2012 at 14:27 | comment | added | SingleNegationElimination |
alternately, you can use str.index instead of str.find to raise an exception when the needle is not in the haystack.
|
|
Jan 1, 2012 at 12:50 | comment | added | dbr |
This returns the last character if the string doesn't contain /wa (path[-1:] ), so if that might happen you'd want to check if "/wa" in path first
|
|
Jan 1, 2012 at 12:31 | vote | accept | Natim | ||
Nov 8, 2013 at 14:32 | |||||
Jan 1, 2012 at 12:23 | comment | added | Eric O. Lebigot | +1: compared to using a regular expression, this is simpler, and probably about as fast. | |
Jan 1, 2012 at 12:20 | history | answered | Felix Loether | CC BY-SA 3.0 |