2012-06-28 168 views

回答

0

你试过了什么?我没有真正遵循你的格式。

f=open(filepath, 'r') 
hold = f.read() 
#hold now = 'A 0001 1212 00 @@ word' 
holdout = hold.replace('@@ word','') 
#holdout now = 'A 0001 1212 00 ' 
#the replace call uses this format 
#string.replace('what it is looking for', 'what it is going to be') 

这是你想要的吗?这个文件只有一行吗?

+0

只有文本文件包含“A 0001 1212 00 @@ word”ok当我试图获取“word”时,那么0001 1212文本应该显示在输出文件 – testing

+0

中您可以将数据作为字符串导入,然后执行字符串 - 'word' 。这是你在你的输出中寻找什么?你可以做一个格式化和所需的后格式化例子之前? (你应该编辑你的问题)。 – deadstump

+0

@testing查看我的编辑。这是你想要的吗? – deadstump

相关问题