Rename Files in Python

Posted by Jeff on Stack Overflow See other posts from Stack Overflow or by Jeff
Published on 2010-05-03T15:17:38Z Indexed on 2010/05/03 15:28 UTC
Read the original article Hit count: 117

Filed under:
|

Hi all,

Im trying to rename some files in a directory using python. I've looked around the forums here, and because i'm a noob, I cant adapt what I need from what is out there.

Say I have a file called CHEESE_CHEESE_TYPE.*** and want to remove "Cheese_" so my resulting filename would be "CHEESE_TYPE"

Im trying to use the os.path.split but it's not working properly.

I have also considered using string manipulations, but have not been successful with that either.

Any help would be greatly appreciated. Thanks.

© Stack Overflow or respective owner

Related posts about python

Related posts about file-rename