I'm (trying to) parsing outputs from a software used by my research group and, so far, I was able to iterate, line by line, the lists I need (ok, there is this little annoying empty list [] at the end of the loop). The real problem starts when I try to append the lists I got in each iteration to a big list (a list of lists) so I can work with it outside the loop.
So far, here is the code:
vdf_file_path = "/home/henrique/Coding/Python/VEDA2XLSX/nq1a.vdf"
vdf_big_list = []
vdf_s_lines_string = """ """
with open(vdf_file_path, "r") as vdf_all_input_lines:
for vdf_line in vdf_all_input_lines.readlines()[4:]:
if "Frequencies" in vdf_line:
break
else:
vdf_s_line_fixed = vdf_line.strip()
vdf_s_lines_list = list(filter(None,vdf_s_line_fixed.split(" ")))
vdf_big_list = vdf_big_list.append(vdf_s_lines_list)
(forgive me for the messy code, I'm still learning)
Then I receive the error:
Traceback (most recent call last):
File "/home/henrique/Coding/Python/VEDA2XLSX/importvdf.py", line 12, in <module>
vdf_big_list = vdf_big_list.append(vdf_s_lines_list)
AttributeError: 'NoneType' object has no attribute 'append'
Despite reading the answer provided here and trying several approaches, I'm still unable to understand what is the problem and fix it.
Any advices?
Data Sample:
abbreviation of: e:\documents\yyyy\yyyyyy-yyyyyy\camb3lyp\dmso\veda\nq1a.ved
IR spectrum from file: e:\Documents\yyyyyyy\yyyyyyyyy-yyyyyyyy\CAMB3LYP\dmso\Veda\nq1a.out
diagonality factor = 53.06 <EPm> = 49.71
IR RAMAN CM-1
245.54 730.41 3538.10 s1 100
3.93 204.17 3237.13 s6 93
11.13 477.42 3233.43 s3 14 s5 76
3.44 136.83 3229.53 s3 -78 s5 15
262.17 212.10 1672.05 s16 61
117.64 169.79 1669.31 s17 -64 s41 14
9.66 60.78 1657.86 s19 -59 s44 10
981.59 1079.26 1642.51 s18 -56
1030.99 315.40 1578.03 s37 40 s42 10
185.95 27.40 1559.81 s37 20 s42 -37
55.61 10.42 1535.81 s39 -53 s63 14
4.91 5.16 1507.94 s20 -37 s40 44
59.12 24.29 1504.96 s47 69 s76 -23
14.09 29.85 1492.35 s46 -71 s75 22
19.97 9.49 1487.58 s48 86
17.93 4.37 1469.24 s21 -39 s43 -27