錯誤:unbound method read() must be called with rawconfigparser instance as first argument (got str instance instead)
解答:因為read不是靜態方法,所以必須例項化才能使用
錯誤:valueerror: dictionary update sequence element #0 has length 1; 2 is required
解答:字典和字串的轉換,不單單是指str() dict()之間的轉換,即使這樣做,也會繼續報這個錯誤
字串和字典的轉換要用eval()
peewee 使用報錯 peewee.inte***ceerror: (0, '')
經查原因是需要新增資料庫連線池,長連線導致沒有了連線
peewee 使用報錯 exceed max connections 連線池滿了:
使用database.connection_context()在使用萬鏈結自動斷開,依舊會出現這樣的錯誤
threadpoolexexutor 的使用
如果我們要使用的方法是要傳遞乙個需要迭代的引數,可以使用map
如果有固定的引數和迭代的引數,可以使用submit
參考樣例,親測可以
with threadpoolexecutor(max_workers=3) as executor:
future_tasks = [executor.submit(函式,迭代引數,非迭代引數)for 迭代引數 in 迭代引數陣列]
for future in as_completed(future_tasks): # 迭代生成器
try:
future.result()
except exception as e:
print('%s' % e)
# 獲取campaign的成效資料
with threadpoolexecutor(max_workers=3) as executor:
executor.map(函式,迭代引數陣列)
hexo遇到的各種坑
同時當你部署完成之後,雖然你的部落格裡有了,但是點進去就是404 解決方案 把你即將要上傳的檔案的檔名中的空格刪掉就可以了。在hexo generator sitemap和hexo generator baidu sitemap生成的站點地圖裡面鏈結全是.但是我想分別做coding.me和githu...
python中常遇到的坑
這篇文章記錄學習python過程中遇到的坑 逐步更新 一 python 引用型別賦值 引用型別賦值的時候一定要採用拷貝的方式,不可直接賦值 例如 list1 1,2,3,4 list2 list list2 list1 此時如果對list2進行操作,list1也會受到影響 如果不想list1,lis...
跳出python的各種坑(1)
2017 11 1915 38 17 一定要跳出python的各種坑,一開始遇到的好多思維上的認知錯誤,因為剛開始學習,對python是個什麼都不清楚,所以記錄一下自己遇到的各種坑。不用擔心自己遇到的問題有多搞笑,因為自己本就是什麼都不知道,思維跳到坑里,短時間爬出來就好了,不要行為上跳到坑里,那樣...