def to_xml(self):
read = Element('read')
if self.echo is not None:
read.set('echo', self.echo)
if self.length is not None:
length = Element('length')
length.text = str(self.length)
read.append(length)
for thing in ('delim', 'match', 'assign'):
if getattr(self, thing) is not None:
read.append(getattr(self, thing).to_xml())
if self.timeout is not None:
timeout = Element('timeout')
timeout.text = str(self.timeout)
read.append(timeout)
return read
评论列表
文章目录