def writeFile(filename):
prose = r"<?xml version='1.0' encoding='UTF-8'?>"
startTag = r'<Books>'
endTag = r'</Books>'
with open(filename, "+a" ) as f:
f.write(prose)
f.write('\n')
f.write(startTag)
f.write('\n')
f.write(endTag)
Run Code Online (Sandbox Code Playgroud)
我如何使这个功能平台独立,因此它可以在Windows和Linux/Unix上工作因为/ n是Windows上的新行字符.
我在Python 3.3上
| 归档时间: |
|
| 查看次数: |
377 次 |
| 最近记录: |