我正在尝试输入一个字符串并使用表进行转换,但是当我这样做时,我得到“TypeError:不支持的操作数类型+:'builtin_function_or_method'和'str'”
def solution(s):
word = input("Enter Text:" ).lower()
for i in range(0, len(s)):
if s[i].isupper():
word=input + '000001'
word=input+braillecodes[asciicodes.index(s[i].lower())]
return word
#The Alpha Lookup Table
asciicodes = [' ', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
braillecodes = [
'000000',
'100000',
'110000',
'100100',
'100110',
'100010',
'110100',
'110110',
'110010',
'010100',
'010110',
'101000',
'111000',
'101100',
'101110',
'101010',
'111100',
'111110',
'111010',
'011100',
'011110',
'101001',
'111001',
'010111',
'101101',
'101111',
'101011']
#Print
print (solution('s'))
答案 0 :(得分:0)
您正在尝试将内置 input
添加到 str
,这就是您收到错误的原因。