-3

この形式の「A 0001 1212 00 @@ word」を含むテキスト ファイルがあります。Word にアクセスするときに印刷したいのですが、0001 1212 の部分だけを表示する必要があり、00 も動的に表示する必要があります。

4

1 に答える 1

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')

これは、あなたの望むことですか?このファイルには1行しかありませんか?

于 2012-06-28T18:15:58.103 に答える