两个文件的内容我有一个文件名exclusionlist.txt和我有内容像比较使用python
import os
import re
import subprocess
......and many more
我有另一个libraries.txt文件命名,该文件的内容是
import mymodule
import empmodule,os
import subprocess
import datetime,logging,re
.......and many more
我的问题是,从蟒蛇怎么知道这是在exclusionlist.txt内容也出现在libraries.txt因为这混乱了..
f = open('exclusionlist.txt', 'r')
f.read()
f1= open('libraries.txt', 'r')
f1.read()
if (//Is contents of f1 present in f2):
print libraries found
else:
print not found
f.close()
f1.close()
如果在这里你的目标是从加载某些模块停止Python代码(即在沙箱环境中运行代码),那么你可能想看看rexec模块,它提供了一个“受限制的执行框架”(带有警告)。 – 2011-06-04 07:27:25