Advertisement
Guest User

yiplassign

a guest
Jul 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import sys
  2.  
  3. args = sys.argv
  4.  
  5. #print(str(args))
  6.  
  7.  
  8.  
  9.  
  10.  
  11. warning=0
  12. error=0
  13. #dates={}
  14. error_type=[]
  15. dates=[]
  16. dic={}
  17. fp = open(args[1]) # open file on read mode
  18. lines = fp.read().split("\n") # create a list containing all lines
  19. #dates.append(lines[0])
  20. for i in range(len(lines)):
  21.     words=lines[i].split(" ")
  22.     dates.append(words[0])
  23.     error_type.append(words[7])
  24.  
  25.     #dates.append(words[0])
  26.     print(i, lines[i])
  27.  
  28. print("=======this is dictionary====")
  29.  
  30. for i in range(len(dates)):
  31.     current = dates[i]
  32.    
  33.     dic[dates[i]]=error_type[i]
  34.  
  35. print(str(dic))
  36.    
  37. fp.close() # close file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement