Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import argv, exit
- import re
- if len(argv) < 2:
- print("mising command-line argument")
- exit(1)
- with open(argv[1], "r") as f:
- count = 0
- contents = f.read()
- print("contents prints: ")
- print(contents)
- #print(contents[0:4])
- i = 0
- j = i + 4
- while contents[i:j]: # will read contents until end of file
- span = contents[i:j]
- #count = 0
- while contents[i+4:j+4] == span:
- count += 1
- #print("span reapeats " + str(count) + " times" )
- i += 4
- j += 4
- i += 4
- j += 4
- print("span " + span + " reapeats " + str(count) + " consecutive times" )
Advertisement
Add Comment
Please, Sign In to add comment