DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5的解决办法
生活随笔
收集整理的這篇文章主要介紹了
DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5的解决办法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天在學習python的md5模塊的時候,做練習,遇到DeprecationWarning: the md5 module is deprecated; use hashlib instead
? import md5的警告;
執行結果為:
解決辦法:
# /usr/bin/python # -*- coding:utf-8 -*- try:import hashlibhash = hashlib.md5() except ImportError:# for Python << 2.5import md5hash = md5.new() hash.update('spam,spam,and egges') print repr(hash.digest())如代碼所示,我使用的python版本是2.6.6,所以會有警告,如果是2.5之前的版本就不會有了。
?
轉載于:https://www.cnblogs.com/mingaixin/archive/2013/02/20/2918874.html
總結
以上是生活随笔為你收集整理的DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5的解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: When.js 1.8.0 发布,Pro
- 下一篇: SharePoint【调试,诊错系列】-