annotate predict/read_file.py @ 40:d5e10cdd486d draft

Uploaded
author tyty
date Mon, 20 Oct 2014 14:57:57 -0400
parents a292aaf51735
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