Last active
August 29, 2015 14:06
-
-
Save 6LYTH3/6d292ae95319152a0e7b to your computer and use it in GitHub Desktop.
auto replicate new parametric table
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
#!/usr/bin/python | |
import re | |
pattern = '--' | |
boxPattern = '/' | |
container = [] | |
def Main(): | |
with open('out.txt', 'wt') as fout: | |
with open('replicate_new_parametric_table', 'rt') as fin: | |
for line in fin: | |
if not re.search(pattern,line): | |
fout.write(line) | |
def Find(): | |
flag = 0 | |
box = '' | |
with open('out.txt', 'rt') as f: | |
for line in f: | |
match = re.search(boxPattern,line) | |
if match: flag += 1 | |
if flag == 0: | |
box += line | |
if flag == 1: | |
Store(box) | |
box = '' | |
flag = 0 # Clear Flag | |
def Store(box): | |
container.append(box) | |
if __name__ == "__main__": | |
Main() | |
Find() | |
print len(container) | |
print container[10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment