-
-
Save TheSkorm/683bf8d1fbe0fbea8c61 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| f = open('Downloads/input.txt', 'r') | |
| chars=0 | |
| memory=0 | |
| for line in f: | |
| print bytes(line[:-1]) | |
| print len(bytes(line[:-1])) | |
| print len(line.decode('string_escape'))-3 | |
| memory += len(bytes(line[:-1])) | |
| chars += len(line.decode('string_escape'))-3 | |
| print memory - chars | |
| f = open('Downloads/input.txt', 'r') | |
| chars=0 | |
| memory=0 | |
| for line in f: | |
| print bytes(line[:-1]) | |
| print len(bytes(line[:-1])) | |
| print len('"'+ line[:-1].replace("\\","\\\\").replace("\"","\\\"") + '"') | |
| memory += len(bytes(line[:-1])) | |
| chars += len('"'+ line[:-1].replace("\\","\\\\").replace("\"","\\\"") + '"') | |
| print chars - memory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment