Convert alphabet letters to number in Python

后端 未结 16 1805
慢半拍i
慢半拍i 2020-11-28 05:09

How can the following be finished?

characters = [\'a\'\'b\'\'c\'\'d\'\'e\'\'f\'\'g\'\'h\'\'i\'\'j\'\'k\'\'l\'\'m\'\'n\'\'o\'\'p\'\'q\'\'r\'\'t\'\'u\'\'v\'\'w         


        
16条回答
  •  孤独总比滥情好
    2020-11-28 05:42

    Here is my solution for a problem where you want to convert all the letters in a string with position of those letters in English alphabet and return a string of those nos.

    https://gist.github.com/bondnotanymore/e0f1dcaacfb782348e74fac8b224769e

    Let me know if you want to understand it in detail.I have used the following concepts - List comprehension - Dictionary comprehension

提交回复
热议问题