Guest User

Words in Mirror

a guest
Oct 27th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. import re
  2. import editor
  3.  
  4. f = open("c:\Folder1\Bebe.txt", "r")
  5.  
  6. def reverseWord(match):
  7.     str = match.group(1)
  8.     return ''.join(reversed(str))
  9.  
  10. editor.rereplace('(\w+)', reverseWord)
  11.  
  12. with open("Bebe.txt", "w") as some_file_handle:
  13.     some_file_handle.write(reverseWord)
Advertisement
Add Comment
Please, Sign In to add comment