0
我已经编写了读取远程系统文件的代码,这些文件工作正常,但读取远程文件需要很长时间。我想提高阅读的表现。如何在python中提高读取远程系统文件的性能
我也用python线程来读取远程系统文件。这也需要很多时间。现在任何人都可以让我知道更好的建议。
我已经使用这个代码,用于读取远程系统文件,
root_folder="\\\\192.168.1.1\\C$"
try:
use_dict={}
use_dict['remote']=unicode(root_folder)
use_dict['password']=unicode("example")
use_dict['username']=unicode("example")
win32net.NetUseAdd(None, 2, use_dict)
print "Network connection established"
except:
print "Network connection failed"
for root, dirnames, filenames in os.walk(root_folder):
for filename in filenames:
match=os.path.join(root, filename)
datafile = file(match)
for line in datafile:
for li in line:
print li
从这个代码,45分钟时间正在读取远程系统文件。如果我以本地方式读取相同的文件,那么它只需要5分钟。所以我无法提高阅读效果。请让我知道了提高性能的阅读...
感谢...