-
-
Save rogerhu/bef3c9cba4005f346002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wages = open("myfile.txt", "r").readlines() | |
# http://www.socialsecurity.gov/employer/efw/14efw2.pdf#zoom=100 | |
def print_sequence(line, start, end): | |
return line[start - 1:end] | |
def dollars(amt): | |
return float(amt) / 100 | |
rw = wages[2] | |
print "--RW record--" | |
print "RI: %s" % print_sequence(rw, 1, 2) | |
print "SSN: %s" % print_sequence(rw, 3, 11) | |
print "First: %s" % print_sequence(rw, 12, 26) | |
print "Middle: %s" % print_sequence(rw, 27, 41) | |
print "Last: %s" % print_sequence(rw, 42, 61) | |
print "Wages: %s" % dollars(print_sequence(rw, 188, 198)) | |
print "Withehld: %s" % dollars(print_sequence(rw, 199, 209)) | |
print "SS Wages: %s" % dollars(print_sequence(rw, 210, 220)) | |
print "SS Wages Withheld: %s" % dollars(print_sequence(rw, 221, 231)) | |
print "Medicare: %s" % dollars(print_sequence(rw, 232, 242)) | |
print "Medicare withheld: %s" % dollars(print_sequence(rw, 243, 253)) | |
print "SS Tips: %s" % dollars(print_sequence(rw, 254, 264)) | |
print "Blank: %s" % (print_sequence(rw, 265, 275)) | |
rt = wages[3] | |
print "--RT record--" | |
print "RI: %s" % print_sequence(rt, 1, 2) | |
print "Number of RW records: %s" % int(print_sequence(rt, 3, 9)) | |
print "Wages: %s" % dollars(print_sequence(rt, 10, 24)) | |
print "Federal: %s" % dollars(print_sequence(rt, 25, 39)) | |
print "Social: %s" % dollars(print_sequence(rt, 40, 54)) | |
print "Social Withheld: %s" % dollars(print_sequence(rt, 55, 69)) | |
print "Medicare: %s" % dollars(print_sequence(rt, 70, 84)) | |
print "Medicare Withheld: %s" % dollars(print_sequence(rt, 85, 99)) | |
print "Social Security Tips: %s" % dollars(print_sequence(rt, 100, 114)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment