我有這樣的代碼:蟒蛇臨時文件
import tempfile
def tmp_me():
tmp = tempfile.NamedTemporaryFile()
tmp1 = tempfile.NamedTemporaryFile()
lst = [tmp.name, tmp1.name]
return lst
def exit_dialog():
lst = tmp_me()
print lst
import filecmp
eq = filecmp.cmp(lst[0],lst[1])
print eq
exit_dialog()
我需要比較這2個臨時文件,但我總是得到這樣的錯誤:
WindowsError: [Error 2] : 'c:\\users\\Saul_Tigh\\appdata\\local\\temp\\tmpbkpmeq'
這不是完整的追溯。 – delnan 2011-04-27 10:36:07
是真的,我試圖在我的小項目中使用它。我正在用Tkinter寫一個簡單的記事本。 – 2011-04-27 17:04:33