0

I have these lines of code in a python script and when I execute I always get the error:

"ValueError: zero length field name in format"

for each line which includes the .format(...) command.

# Construct info table (debugging)                                                                                                                                    
table  = []
align  = "{:>6} {:^10} {:>10} {:>10} {:>10} {:^3} {:<10}"
header = align.format("#", "xLow", "x", "xUp", "Purity", "+/-", "Error") #Purity = 1-EWK/Data                                                                         
hLine  = "="*70
table.append("")
table.append(hLine)
table.append("{:^70}".format("TGraph"))
table.append(header)
table.append(hLine)

# For-loop: All values x-y and their errors                                                                                                                           
for i, xV in enumerate(x, 0):
    row = align.format(i+1, "%.2f" % xerrl[i], "%.2f" %  x[i], "%.2f" %  xerrh[i], "%.3f" %  y[i], "+/-", "%.3f" %  yerrh[i])
    table.append(row)
table.append(hLine)

Am I doing something wrong? What am I missing?

Best Regards, Marina

0 Answers0