Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 使用导入XML.etree.ElementTree使用python将XML解析为CSV_Python 3.x_Csv_Xml Parsing_Elementtree - Fatal编程技术网

Python 3.x 使用导入XML.etree.ElementTree使用python将XML解析为CSV

Python 3.x 使用导入XML.etree.ElementTree使用python将XML解析为CSV,python-3.x,csv,xml-parsing,elementtree,Python 3.x,Csv,Xml Parsing,Elementtree,请帮助我完成下面提到的场景,我尝试了两个场景,但都没有达到预期效果,我需要在相应的列中添加行值,我是Python新手。在此附上示例o/p。提前感谢。 示例XML <meta ID="1A" value="22" type=""> <student-names> <student>AA</student> <st

请帮助我完成下面提到的场景,我尝试了两个场景,但都没有达到预期效果,我需要在相应的列中添加行值,我是Python新手。在此附上示例o/p。提前感谢。

示例XML

    <meta ID="1A" value="22" type="">
        <student-names>
            <student>AA</student>
            <student>BB</student>
            <student>CC</student>
            <student>DD</student>
            <student>EE</student>
            <student>FF</student>
         </student-names>
        <categories>
                <row>
                    <category>1</category>
                    <category>2</category>
                    <category>3</category>
                    <category>4</category>
                    <category>5</category>
                    <category>6</category>
                    
                </row>
                <row>
                    <category>7</category>
                    <category>8</category>
                    <category>9</category>
                    <category>10</category>
                    <category>11</category>
                    <category>12</category>
                                         
                </row>
        </categories> 
      <student-names>
            <student>GG</student>
            <student>HH</student>
            <student>II</student>
            <student>JJ</student>
            <student>KK</student>
            <student>LL</student>
         </student-names>
        <categories>
                <row>
                    <category>91</category>
                    <category>92</category>
                    <category>93</category>
                    <category>94</category>
                    <category>95</category>
                    <category>96</category>
                    
                </row>
                <row>
                    <category>71</category>
                    <category>82</category>
                    <category>93</category>
                    <category>14</category>
                    <category>15</category>
                    <category>16</category>
                                         
                </row>
        </categories>   

AA
BB
科科斯群岛
DD
EE
FF
1.
2.
3.
4.
5.
6.
7.
8.
9
10
11
12
游戏打得好
嗯
二,
林俊杰
KK
陆上通信线
91
92
93
94
95
96
71
82
93
14
15
16