直接从官网上拷贝下来的。加了标题: fr = open(r'Lua Reference.md', 'r') fw = open(r'lua_reference.md', 'w') for line in fr: linelist = line.split() if len(linelist) == 0: continue if linelist[0].isdigit(): fw.write(r'# ') fw.write(line) fw.write('\n') continue if linelist[0].split('.')[0].isdigit():