python XML模块新增节点问题

XML增加节点内容

1、执行代码

head1 = root.find('country')    # 获取第一个year节点
body = ET.Element('months')     # 创建一个months节点
body.attrib = {"name":"12"}     # 设置属性
body.text = '24day'             # 新增数据
head1.append(body)              # 通过append方法添加节点


2、xml文件

<data>
    <country name="Liechtenstein">
        <year>2008</year>
        <gdppc>141100</gdppc>
        <neighbor name="Austria" direction="E" />
        <neighbor name="Switzerland" direction="W" />
    </country>
    <data>

问题:

问题:

在year标签下写入节点就报错

'NoneType' object has no attribute 'append'

在country节点下接入节点正常,这是什么情况呢