Created
December 20, 2015 12:32
-
-
Save lwiecek/38bafd0a06769efe2c59 to your computer and use it in GitHub Desktop.
day8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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