I am trying to print a data value from a list to a file. The error keeps printing out that
TypeError: %d format: a number is required, not list
I don't seem to understand.. when I am trying to print each of them individually on the screen I don't have any problem. Can you see where the problem could be?
print >>map_file0, "%d,%d,%d" % (coreid[0],ret_perf[0][0],llc_perf[0][0])
Thanks
If you use the newer string formatting, there is no need to specify the type.
# old
old_method = "%d,%d,%d" % (1, 2, 3)
# new (2.7)
new_method = "{},{},{}".format(1, 2, 3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With