Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. # read data
  2.  
  3. STUDENT_DATA = open("student_data.txt", "r")
  4.  
  5. def Organize():
  6.     line_list = []
  7.     lines = 0
  8.     for line in STUDENT_DATA:
  9.         # make a list with each line
  10.         line_list.append(line)
  11.         lines = lines + 1
  12.  
  13.     # Counter init
  14.     # count = 1
  15.     for i in range(0, int(lines/10)):
  16.        
  17.         line = line_list[0].split('|')
  18.         first_name = line[0].ljust(15)
  19.         last_name = line[1].ljust(15)
  20.         DOB = line[2].ljust(25)
  21.         email = line[3].strip('\n')
  22.  
  23.         print('\n' + first_name, last_name, DOB, email)
  24.         print('-' * 90)
  25.  
  26.         # here is where I am trying to slice into
  27.         for line in line_list[1:11]:    
  28.             line = line.split('|')
  29.             first_name = line[0].ljust(15)
  30.             last_name = line[1].ljust(15)
  31.             DOB = line[2].ljust(25)
  32.             email = line[3].strip('\n')
  33.  
  34.             # trying to make a counter to slice into the list
  35.             # count = count + 10
  36.             print(first_name, last_name, DOB, email)
  37.                            
  38. Organize()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement