Advertisement
Guest User

mapper2.py

a guest
Mar 14th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import sys
  4.  
  5. def read_input(file, separator='\t'):
  6.     for line in file:
  7.         yield line.rstrip().split(separator, 1)
  8.  
  9. def main(separator='\t'):
  10.     # Input comes from STDIN
  11.     data = read_input(sys.stdin)
  12.     for uri in data:
  13.         # Invert <number of properties> and <subject>
  14.         print '%s%s%s' % (uri[1], separator, uri[0])
  15.  
  16. if __name__ == "__main__":
  17.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement