Skip to content

Instantly share code, notes, and snippets.

@lwiecek
Created December 20, 2015 12:32
Show Gist options
  • Save lwiecek/38bafd0a06769efe2c59 to your computer and use it in GitHub Desktop.
Save lwiecek/38bafd0a06769efe2c59 to your computer and use it in GitHub Desktop.
day8
total = 0
with open('input8.txt') as f:
for line in f:
line = line.strip()
# part1:
# total += len(line) - len(eval(line))
# part2:
new_repr = '"' + line.replace('\\', '\\\\').replace('"', '\\"') + '"'
total += len(new_repr) - len(line)
print(total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment