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

StackOverflow https://stackoverflow.com/questions/16651323

  •  30-05-2022
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top