列表出现语法错误,如果我删除列表它只是使代码下面的语法错误?

时间:2017-01-27 20:50:40

标签: python python-2.7

我对Python很新,但我很困惑为什么会发生这种情况,当我尝试运行它时,我在第5行遇到语法错误。我做错了什么?

非常感谢任何帮助!

braille_dict = {"a":"100000","b":"110000","c":"100100","d":"100110","e":"100010","f":"110100","g":"110110","h":"110010","i":"010100","j":"010110","k":"101000","l":"111000","m":"101100","n":"101110","o":"101010","p":"111100","q":"111110","r":"111010","s":"011100","t":"011110","u":"101001","v":"111001","w":"010111","x":"100100","y":"101111","z":"101011"," ":"000000"}

braille_in = list(input("Text to be translated?")
braille_out = []

def let_brai (a):
  cap_list = []
  if a.isupper() == True:
    cap_list.append("000001")
    a = a.lower()
  for k,v in braille_dict.items:
    if a == k:
      cap_list.append(v) 
      return cap_list

for x in range(len(braille_in)):
  b = let_brai(braille_in[x]
  braille_out += b

print(', '.join(braille_out)

0 个答案:

没有答案