Pylint says 'string' module is deprecated. What's the new way to get range of lowercase characters?

浪子不回头ぞ 提交于 2019-12-23 06:49:12

问题


I was just pylinting some code and noticed a colleague had imported the old Python 'string' module, not to use any functions from it but simply to have access to the constant 'string.lowercase'.

I removed the deprecated import and substituted 'abcdef...' for string.lowercase, but I was wondering: is there a better way I should be doing this?


回答1:


string itself is not deprecated, just those methods like string.join that are better accessed through a string object. You can still import string, and get string.ascii_lowercase for what you want.

pylint's reporting this as an error is a known bug - see http://www.logilab.org/ticket/2481.



来源:https://stackoverflow.com/questions/16651323/pylint-says-string-module-is-deprecated-whats-the-new-way-to-get-range-of-lo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!