Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use names to locate the attributes instead of using the index. #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions xml_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def xml_to_csv(path):
classes_names.append(member[0].text)
value = (
root.find("filename").text,
int(root.find("size")[0].text),
int(root.find("size")[1].text),
member[0].text,
int(member[4][0].text),
int(member[4][1].text),
int(member[4][2].text),
int(member[4][3].text),
int(root.find("size").find("width").text),
int(root.find("size").find("height").text),
member.find("name").text,
int(member.find("bndbox").find("xmin").text),
int(member.find("bndbox").find("ymin").text),
int(member.find("bndbox").find("xmax").text),
int(member.find("bndbox").find("ymax").text),
)
xml_list.append(value)
column_name = [
Expand Down