百度下载一个脚本的时候遇到那么一个情况。每行的开头多了一个空格。https://www.0dayhack.com/post-104.html
一个个删就不要说了,很烦。于是就有了下面这个脚本。
#! /usr/env/bin/ python # by i3ekr with open("./fj/2.txt","r+") as f: lines = f.readlines() for i in lines: ok = i[:1].replace(" ","") + i[1:] with open("./ok.txt","a") as f: f.writelines(ok) f.close()