I am using python 3.7
My list data looks like this
[['file1.o', '.text', '0x30'], ['file2.o', '.initvector', '0x36'], ['15', '31', '0x72']]
My code
for i in module_info: row = [i[0], i[1], "%d" %(i[2]/1024)] writer.writerow(row)
TypeError: unsupported operand type(s) for /: 'str' and 'int'
How can I fix this?
New Update:
I changed the way I was parsing the file and reading its contents.
#old line c = re.compile("^\w+.*(\w+)\s+([\.\w]+)\s+([\w\.]+).*$") #new line c = re.compile("^\w+\+(\w+)\s+([\.\w]+)\s+([\w\.]+).*$")
so now writing to file changes to this
for i in module_info: row = [i[0], i[1], (i[2])] writer.writerow(row)
https://stackoverflow.com/questions/66955096/typeerror-unsupported-operand-types-for-str-and-int-for April 05, 2021 at 11:02PM
没有评论:
发表评论