-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapper.py
More file actions
20 lines (17 loc) · 722 Bytes
/
mapper.py
File metadata and controls
20 lines (17 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python
import sys
#for skipping data analysis on the first line
for j, line in enumerate(sys.stdin, -1):
if (j>=0):
#taking each line into a variable "line"
line = line.strip()
#taking all the words in the line separated by comma to variable line
words = line.split(",")
count = 0
length = len(words)
#considering the last 5 elements of the array
for i in reversed(words):
if ( count < 5 and i != ""):
print '%s\t%s' % (i, 1)
count = count + 1
~