Advertisement
expired6978

Untitled

Jun 13th, 2014
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def renameObject(originalFile, newFile, name, remove=False):
  2.     with open(newFile, "wb") as out:
  3.         for line in open(originalFile):
  4.             newLine = line.replace(name[0], name[1])
  5.             out.write(bytes(newLine.rstrip('\n'), 'UTF-8') + bytes('\x0A', 'UTF-8'))
  6.         if remove:
  7.             os.remove(originalFile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement