Skip to content

Instantly share code, notes, and snippets.

@raffaem
Created December 5, 2021 09:38
Show Gist options
  • Save raffaem/80c328ff9bc3cc811d8604834684f3e1 to your computer and use it in GitHub Desktop.
Save raffaem/80c328ff9bc3cc811d8604834684f3e1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
import re
with open(sys.argv[1], "r", encoding="utf8") as fh:
data = fh.read()
s = re.search(r"^(DTSTART:\d{8}T\d{6})$", data, re.MULTILINE).group(1)
data = data.replace(s, s+"Z")
s = re.search(r"^(DTEND:\d{8}T\d{6})$", data, re.MULTILINE).group(1)
data = data.replace(s, s+"Z")
with open(sys.argv[1], "w", encoding="utf8") as fh:
fh.write(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment