<[email protected]> wrote

The problem is that for example the file Flag_of_the_United_States.svg when I use the strip('.svg') it is returned as Flag_of_the_United_State

Thats because strip removes all of the characters in the given string.

You would probably be better removing the extension using the os.path.splitext() function.

Also, How do I remove 'Flag_of', 'Flag_of_the_'

You could try replacing with a null string. Do the second one first followed by the first if necessary, using the string.replace() method.

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to