with open(r'F:\360MoveData\Users\20122\Desktop\chengxu.txt','r') as f1:
    with open(r'F:\360MoveData\Users\20122\Desktop\chengxu_1.txt','w') as f2:
        while data:
            data = f1.readline()
            if data != "\n":
                f2.write(data)
print("转换成功")

#如要使用,上面的文件的地址请自行修改。
#with ... as ...具有自动关闭文件功能。