相关疑难解决方法(0)

无法加载腌制对象

我遇到的问题是当我尝试加载pickle对象时.我尝试过使用两者pickle.loads,pickle.load结果如下:

pickle.loads - pickle.loads

pickle.load - pickle.load

有谁能告诉我在这个过程中我做错了什么?谢谢,这是我的代码:

elif str(parser) == 'SwissWithdrawn_Parser':
       # swissprot name changes
       print('Gathering SwissProt update info...')
       cache_hits = 0
       cache_misses = 0
       files = set()

       for f in os.listdir('out/cache/'):
           if os.path.isfile('out/cache/'+f):
               files.add(f)

       for name in sp_lost_names:

           cached = False
           url = 'http://www.uniprot.org/uniprot/?query=mnemonic%3a'+name+ \
               '+active%3ayes&format=tab&columns=entry%20name'
           hashed_url = str(hash(url))

           ################### For Testing Only - use cache ##################
           if hashed_url in files:
               cached = True
               cache_hits += 1
               content = pickle.loads('out/cache/' +hashed_url)  # …
Run Code Online (Sandbox Code Playgroud)

python pickle python-3.x

48
推荐指数
2
解决办法
3万
查看次数

标签 统计

pickle ×1

python ×1

python-3.x ×1