XMLfileをmysqldbに解析しようとしています。ここにxmlがあります
<categories>
<category id="28">Woman</category>
<category id="277" parentId="28">T-Shirts</category>
<category id="140" parentId="277">shorts</category>
</category>
.py
for category in categories:
for item in category.getElementsByTagName("category"):
category_name = item.childNodes[0].nodeValue.encode("utf-8")
category_id = int(item.getAttribute('id'))
category_parentId = item.getAttribute('parentId')
#connect etc
sqlFillCategories = "INSERT INTO categories(category_id, category_parentId, shop_id, category_name) VALUES ('"+category_id + "', '" + category_parentId + "', '" + TREND_BRANDS_SHOPID + "', '" + category_name + "');"
エラー:
Traceback (most recent call last):
File "E:/python1/fanswell/parse.py", line 23, in <module>
sqlFillCategories = "INSERT INTO categories(category_id, category_parentId, shop_id, category_name) VALUES ('"+category_id + "', '" + category_parentId + "', '" + TREND_BRANDS_SHOPID + "', '" + category_name + "');"
TypeError: cannot concatenate 'str' and 'int' objects
どうしてこんなことに?どうしたの?