Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list1 = []
- list2 = []
- fin = open('foobar.txt')
- for line in fin:
- for a in line:
- if a.isupper():
- list1.append("0")
- list2.append(a)
- elif a.islower():
- list1.append("1")
- list2.append(a)
- converted = ''.join(list1)
- unconverted = ''.join(list2)
- win = converted.find('100010001')
- print unconverted[win+1:win+8]
- def find_all(a_str, sub):
- start = 0
- while True:
- start = a_str.find(sub, start)
- if start == -1: return
- yield start
- start += len(sub)
- win1 = list(find_all(converted, '100010001')) # [0, 5, 10, 15]
- for a in win1: print unconverted[a:a+9]
Advertisement
Add Comment
Please, Sign In to add comment