我需要從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