擅长:python、mysql、java
<p>也许直截了当的方法适合你?你知道吗</p>
<pre><code>with open('test.txt') as inp:
with open('result.txt') as outp:
for line in inp:
if line: # skip processing empty lines
items = line.split()
if items[0] == 'J1':
items[123] = input('blahblah')
line = ' '.join(items)
outp.write(line)
</code></pre>
<p>我试着简化代码,我看到的唯一问题是它在编辑后不能保留行中的空格数量。如果有问题,代码应该更新。你知道吗</p>