我有一个大的字符串文本文件,我想分割每117个字符的字符串,并将下一个117个字符放在换行符上,依此类推直到文件结束。Python,分割字符串
我尝试这样做:`S = “” “ 我已删除了可视性原因字符串 ”“” 空间= “” “
”“” 文件=打开( 'testoutput.txt' , 'W') 而S: 打印S [10] 输出=输出+ S + “””
"""
s = s[10:]
file.write(输出) file.close() 印刷 “完成” `
,但有该文件的最终输出看起来像这样级联的问题:'此[SHIFT] R后退键分子及其后代将AV,因为突变后退键后退键改变
T]r[BACKSPACE]molecule and its descendants would av[BACKSPACE][BACKSPACE]vary because of mutations
ACE]molecule and its descendants would av[BACKSPACE][BACKSPACE]vary because of mutations
le and its descendants would av[BACKSPACE][BACKSPACE]vary because of mutations
descendants would av[BACKSPACE][BACKSPACE]vary because of mutations
ts would av[BACKSPACE][BACKSPACE]vary because of mutations
v[BACKSPACE][BACKSPACE]vary because of mutations
E][BACKSPACE]vary because of mutations
CE]vary because of mutations
cause of mutations
utations
`
damnnn打我吧 – tekknolagi 2011-02-03 04:06:31