fork download
  1. with open('input.po', 'r') as input:
  2. lines = input.readlines()
  3.  
  4. for line in lines:
  5. prev = lines[lines.index(line) - 1]
  6. if line.startswith('msgstr ') and prev.startswith('msgid '):
  7. if line.lstrip('msgstr ') == prev.lstrip('msgid '):
  8. lines[lines.index(line)] = 'msgstr ""'
  9.  
  10. with open('output.po', 'w') as output:
  11. for line in lines:
  12. output.write(line)
Runtime error #stdin #stdout #stderr 0.02s 9984KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'input.po'