Skip to content

Commit dce1d7a

Browse files
committed
changed the styling making sure all code is well linted with flake8
1 parent 607cbf2 commit dce1d7a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

json_to_xml/json_to_xml.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
import xml.etree.ElementTree as ET
2+
33

44
def json_to_xml(json_obj, line_padding=""):
55
"""
@@ -30,6 +30,9 @@ def save_xml_file(xml_str, output_file):
3030

3131

3232
def main():
33+
"""
34+
Main function to convert a JSON file to an XML file.
35+
"""
3336
# Input JSON file
3437
input_json_file = "test-input.json"
3538
# Output XML file
@@ -44,7 +47,9 @@ def main():
4447
xml_data = json_to_xml(json_data)
4548

4649
# Add XML header
47-
xml_data_with_header = f"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n{xml_data}"
50+
xml_data_with_header = (
51+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml_data
52+
)
4853

4954
# Save to XML file
5055
save_xml_file(xml_data_with_header, output_xml_file)

0 commit comments

Comments
 (0)