1
大きなファイルを読み込んでいて、その一部を新しいファイルに書きたいと思っています。出力ファイルのスライシング
パターン 'CARTESIAN COORDINATES'がこのファイルに2回表示され、新しいファイルで2番目のオカレンスの前にすべてを省略します。
#!/usr/bin/env python
import string,sys
import numpy as np
from numpy import *
with open("101.out", "r") as f:
content = []
for line in f:
content.append(line)
g = open('101.xyz', 'w')
#write the relevant stuff
f.close()