findreplace.py 782 B

123456789101112131415161718192021222324252627
  1. '''Created Jan 16, 2023 deeejas'''
  2. import os
  3. from subprocess import run
  4. chars = {u'ă': 'a',
  5. u'ș': 's',
  6. u'ş': 's',
  7. u'î': 'i',
  8. u'ț': 't',
  9. u'ţ': 't',
  10. u'â': 'a'}
  11. with open('text.txt')as texts:
  12. text = texts.read()
  13. # text = u'''
  14. # Următoarele venituri cumulate lunar nu reprezintă venit impozabil în înțelesul impozitului pe venit, în limita plafonului lunar de cel mult 33% din salariul de bază corespunzător locului de muncă ocupat sau din solda lunară/salariul lunar acordată/acordat potrivit legii:
  15. # '''
  16. copyq = os.getenv('COPYQ', 'copyq')
  17. new_text = ''
  18. for char, repl in chars.items():
  19. text = text.replace(char, repl)
  20. text = text.replace(char.upper(), repl.upper())
  21. run([copyq, 'add', text])