Advertisement
Guest User

Untitled

a guest
Sep 12th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. def read_conn_file(path: str) -> None:
  2.     try:
  3.         with open(path) as f:
  4.             for line in f:
  5.                 if line[0] == '#':
  6.                     # Ignore comments.
  7.                     continue
  8.                 conn_line: str = line.rstrip()
  9.                 conn_line_splited: list = conn_line.split('\t')
  10.  
  11.                 timestamp = float(conn_line_splited[0])
  12.                 conn_uid = conn_line_splited[1]
  13.                 src_ip = conn_line_splited[2]
  14.                 # ETC.
  15.     except FileNotFoundError:
  16.         print('Error: ')
  17.  
  18.  
  19. path = 'PATH_TO_CONN_FILE'
  20. read_conn_file(path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement