开发者

Import variables in python

开发者 https://www.devze.com 2023-02-24 02:02 出处:网络
I ran a python script to create a dict variable based on a database, and then I pickled this variable into disk file for later usage. Now I have a lot of feature classes which all need that variable t

I ran a python script to create a dict variable based on a database, and then I pickled this variable into disk file for later usage. Now I have a lot of feature classes which all need that variable to create different features. The thing is the dict variable is so large that cannot afford to import multiple times. I am wondering if there is a way I can unpickle and import that variable for only once, and th开发者_运维知识库en all feature class can share it?


Python will only import the module once. Any code that executes at load time will only be executed the first time a file imports the module.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号