Guest User

Untitled

a guest
Nov 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def change_deco(name, deco, placeholder=' #'):
  2. with open(name + '.py', 'r') as file:
  3. lines = file.readlines()
  4. for idx, string in enumerate(lines):
  5. if placeholder in string and repr(placeholder) not in string:
  6. lines[idx] = f' @{deco}\r\n'
  7. exec(''.join(lines))
  8. return locals()[name]
Add Comment
Please, Sign In to add comment