I need to read these lines from a .txt file:
Turn 60 Player -1
board: [[ 0 0 0 0 1 2 0 6 12 0 1 0 0 5 5 21]]
action p-values: [0.0, 0.0, 0.0, 0.0, 0.6326530612244898, 0.3673469387755102, 0.0]
nn: legal moves:[4, 5]
nn: select: 4
nn: db_lookup 0 0 0 0 1 2 0 6 12 0 1 0
nn: scores: [127, 127, 127, 127, -4, -5]
nn: best move selected
How can I extract the number in the array action p-values?
I need to create the same array.
This is my starting point:
with open(match, 'r') as searchfile:
for line in searchfile:
if 'Turn' in line:
line = next(searchfile)
line = next(searchfile)
if 'p-values' in line:
line.rstrip('\n')
fields = line.split(": ")
pvalues.append(fields[1])
But if i try to print pvalues I get an array with strings inside (included the \n). How can I have in pvalues and array with inside arrays of float?
Thanks