annotate predict/read_file.py @ 4:a292aaf51735 draft

Uploaded
author tyty
date Mon, 15 Sep 2014 14:52:43 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
a292aaf51735 Uploaded
tyty
parents:
diff changeset
1 #!/usr/bin/env python
a292aaf51735 Uploaded
tyty
parents:
diff changeset
2 # -*- coding: utf-8 -*-
a292aaf51735 Uploaded
tyty
parents:
diff changeset
3
a292aaf51735 Uploaded
tyty
parents:
diff changeset
4 import sys
a292aaf51735 Uploaded
tyty
parents:
diff changeset
5
a292aaf51735 Uploaded
tyty
parents:
diff changeset
6
a292aaf51735 Uploaded
tyty
parents:
diff changeset
7
a292aaf51735 Uploaded
tyty
parents:
diff changeset
8 def read_t_file(in_file):
a292aaf51735 Uploaded
tyty
parents:
diff changeset
9 f = open(in_file);
a292aaf51735 Uploaded
tyty
parents:
diff changeset
10 result = [];
a292aaf51735 Uploaded
tyty
parents:
diff changeset
11 for aline in f.readlines():
a292aaf51735 Uploaded
tyty
parents:
diff changeset
12 temp = [];
a292aaf51735 Uploaded
tyty
parents:
diff changeset
13 tline = aline.strip();
a292aaf51735 Uploaded
tyty
parents:
diff changeset
14 tl = tline.split('\t');
a292aaf51735 Uploaded
tyty
parents:
diff changeset
15 for i in range(0, len(tl)):
a292aaf51735 Uploaded
tyty
parents:
diff changeset
16 temp.append(tl[i].strip());
a292aaf51735 Uploaded
tyty
parents:
diff changeset
17 result.append(temp);
a292aaf51735 Uploaded
tyty
parents:
diff changeset
18 f.close();
a292aaf51735 Uploaded
tyty
parents:
diff changeset
19 return result;
a292aaf51735 Uploaded
tyty
parents:
diff changeset
20
a292aaf51735 Uploaded
tyty
parents:
diff changeset
21