Advertisement
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)
- pattern1 = re.compile(r'AGAT')
- pattern2 = re.compile(r'AATG')
- pattern3 = re.compile(r'TATC')
- npattern = re.compile(r'name', re.IGNORECASE) # find all cases of name
- with open(argv[1],"r") as file:
- contents = file.read()
- i = 0
- j = 4
- while contents[i:j]:
- #this works.... save it... prints one string of 4 per line
- if (contents[i:j] == npattern):
- {
- i += 4
- j += 4
- }
- else:
- print(contents[i:j])
- i += 4
- j += 4
- #while contents[i:j]:
- #if contents[i:j] == contents[i+4:j+4]:
- #index = 1
- #mcount = 1
- #while contents[i:j] == contents[i+4*index:j+4*index]:
- #i += 1
- #j += 1
- #mcount += 1
- #index += 1
- #print(str(contents[i:j]) + " count is: " + mcount)
- #mcount=0
- #i = 0
- #j = 4
- #while contents[i:j]:
- #pattern = re.compile(contents[i:j]) #pattern = re.compile(pattern?)
- #if pattern == contents[i+4:j+4]:
- #matches = pattern.finditer(f'{contents}')
- # no longer commented out
- #for match in matches:
- #mcount += 1
- #j += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement