您好 我有一个python编程题目想向您求助 求大神指导 小女子感激不尽。。。

Investigate melting in a three-dimensional system. First determine the structure of the solid (it should be face-centered cubic), then try to locate the melting temperature. 就是求面心立方固体的熔点

#!/usr/bin/env python
#-*- coding: utf-8 -*-

from __future__ import with_statement
import re

values = {}
lines = []
txt_file = 'data.txt'
out_file = 'result.txt'
data_re = re.compile(ur'^(\w)\^(\w)\s+.+?\s+(.+?)\s*$')

with open(txt_file, 'rU') as f:
for line in f:
if '^' in line:
temp = data_re.findall(line)
if temp != []:
name1, name2 = temp[0][:2]
if name1 != name2:
value = float(temp[0][-1])
name = '%s^%s' % (name1, name2)
if name not in values or values[name] < value:
values[name] = value
lines.insert(0, line.strip())

with open(out_file, 'w') as f:
f.write('\n'.join(lines[:3]))
追问

不知道大神可不可以把程序发到我邮箱里 感激不尽啊[email protected]....最好能连图啊结果啊一并发来~~谢谢 各种感激涕零。。。

温馨提示:答案为网友推荐,仅供参考