我需要从Windows XP上的文本文件中删除数字。我是python的新手,刚刚安装它进行数据清理。python:删除文件中的数字
我已经保存在C测试文件:\文件夹1 \ test1.txt的
上test1.txt的这些上下文仅有1线:
This must not b3 delet3d, but the number at the end yes 134411
我想创建的文件result1.txt其中包含
This must not b3 delet3d, but the number at the end yes
这里是我试过到目前为止
import os
fin = os.open('C:\folder1\test1.txt','r')
我得到以下错误:
TypeError: an integer is required.
我不知道它是什么期待整数。
您能否让我知道如何去编程以获得我想要的结果。非常感谢你的帮助。
我编辑你的问题有点让它看起来更好,但我认为双引号实际上并不是文本文件。你能证实情况是这样吗? –
这个问题从何而来?看起来你并不是互联网上第一个询问它的人:http://www.google.ca/search?q=%22This+must+not+b3+delet3d%2C+but+the+n+++ at + the + end + yes + 134411%22&oq =%22 This + must + not + b3 + delet3d%2C + but + the + number + at + the + end + yes + 134411%22 –
有趣的发现,@DavidWolever。我们都成为巨魔饲养员吗? – StevenV