S
sheffdog
Hello,
I often find myself cleaning up strings like the following:
setAttr ".ftn" -type "string" /assets/chars/
/boya/geo/textures/lod1/ppbhat.tga";
Using regular expressions, the best I can do so far is using the re.sub
command but it still takes two lines. Can I do this in one line? Or
should I be approaching this differently? All I want to end up with is
the file name "ppbhat.tga".
Python Code:
lines[indexC]=re.sub("[\s,\S,]*/", "", lines[indexC])
lines[indexC]=re.sub(".tga[\s,\S,]*", ".tga", lines[indexC])
Thanks for your time,
/\/\ason S
I often find myself cleaning up strings like the following:
setAttr ".ftn" -type "string" /assets/chars/
/boya/geo/textures/lod1/ppbhat.tga";
Using regular expressions, the best I can do so far is using the re.sub
command but it still takes two lines. Can I do this in one line? Or
should I be approaching this differently? All I want to end up with is
the file name "ppbhat.tga".
Python Code:
lines[indexC]=re.sub("[\s,\S,]*/", "", lines[indexC])
lines[indexC]=re.sub(".tga[\s,\S,]*", ".tga", lines[indexC])
Thanks for your time,
/\/\ason S