How to use 'python read dat file' in Python

Every line of 'python read dat file' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
15def read_plot_data_file(name_of_file):
16 reading_malware = True
17 index_normal = 0
18 with open(name_of_file) as f:
19 for line in f:
20 if '# NORMAL' in line:
21 reading_malware = False
22 continue
23 if '#' in line:
24 continue
25 split = line.split(': ')
26 if reading_malware:
27 names_of_states.append(split[0])
28 malware_states.append(split[1].rstrip())
29 else:
30 if split[0] != names_of_states[index_normal]:
31 print "Error: Sequence of state name is not same for malware and normal!"
32 return False
33 normal_states.append(split[1].rstrip())
34 index_normal += 1
35
36 # print "malware states:"
37 # print malware_states
38 # print "normal states:"
39 # print normal_states
40 f.close()
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets