forked from IPKM/nmreval
correcter preview for text files with mixed delimiters
This commit is contained in:
parent
5db6a9f2c5
commit
609f135855
@ -15,7 +15,7 @@ NUMBERRE = re.compile(r'[0-9]\.*[0-9]*[Ee]*[+-]*[0-9]*')
|
||||
|
||||
|
||||
class AsciiReader:
|
||||
delimiters = ['\t', ' ', ',']
|
||||
# delimiters = ['\t', ' ', ',']
|
||||
|
||||
def __init__(self, fname):
|
||||
self.fname = None
|
||||
@ -49,7 +49,8 @@ class AsciiReader:
|
||||
with self.fname.open('r') as f:
|
||||
for i, line in enumerate(islice(f, len(self.header)+len(self.lines), num_lines)):
|
||||
line = line.rstrip('\n\t\r, ')
|
||||
line = re.split(r'[\s,;]', line)
|
||||
line = re.sub(r'[\t ;,] *', ';', line)
|
||||
line = line.split(';')
|
||||
|
||||
try:
|
||||
comment_start = line.index('#')
|
||||
|
Loading…
Reference in New Issue
Block a user