मैं एक पाठ में एन-वें चरित्र की वर्णमाला स्थिति पता करने की जरूरत है और मैं this question की answer पढ़ा लेकिन यह मेरी अजगर 3,4पायथन 3.4 में वर्णमाला में वर्ण स्थिति कैसे प्राप्त करें?
मेरे कार्यक्रम
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 22 12:24:15 2016
@author: Asus
"""
import string
message='bonjour'
string.lowercase.index('message[2]')
साथ नहीं काम करता है
यह लोअरकेस के बजाय ascii_lowercase के साथ भी काम नहीं करता है।
त्रुटि संदेश
runfile('C:/Users/Asus/Desktop/Perso/WinPython-64bit-3.4.3.4/python-3.4.3.amd64/Scripts/ESSAI.py', wdir='C:/Users/Asus/Desktop/Perso/WinPython-64bit-3.4.3.4/python-3.4.3.amd64/Scripts') Traceback (most recent call last):
File "", line 1, in runfile('C:/Users/Asus/Desktop/Perso/WinPython-64bit-3.4.3.4/python-3.4.3.amd64/Scripts/ESSAI.py', wdir='C:/Users/Asus/Desktop/Perso/WinPython-64bit-3.4.3.4/python-3.4.3.amd64/Scripts')
File "C:\Users\Asus\Desktop\Perso\WinPython-64bit-3.4.3.4\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile execfile(filename, namespace)
File "C:\Users\Asus\Desktop\Perso\WinPython-64bit-3.4.3.4\python-3.4.3.amd64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 85, in execfile exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "C:/Users/Asus/Desktop/Perso/WinPython-64bit-3.4.3.4/python-3.4.3.amd64/Scripts/ESSAI.py", line 11, in string.lowercase.index('message 2 ')
AttributeError: 'module' object has no attribute 'lowercase'
प्रिंट के जवाब (message.lower()। सूचकांक (संदेश [k])) k मैं वर्णमाला रैंक प्राप्त करना चाहते है। तो संदेश [2] एन है और वर्णमाला में एन का रैंक 14 नहीं 2 है ... ugh:/ –
अब यह आपको धन्यवाद देता है! : डी –