苦苦于在python中找到错误

时间:2016-11-30 20:49:28

标签: python

我正在为我的朋友做生日礼物。我正在建立一个每个奇迹角色的数据库,到目前为止我已经完成了两个,去测试它并且它说错误。我已经查看了所有的代码,我已经尝试了很多,但它似乎没有工作。这是代码。

    from time import sleep

print ("Welcome to the Marvel Database please input the name of a marvel character you want to research. Please make sure you type the name as accurately as possible.")
character = input()

if character == 'A-Bomb':
    print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".")
    print ("Character found.")
    sleep(.5)
    print ("Name is A-Bomb.")
    sleep(1)
    print ("Unknown if they or it are Hero or Villan.")
    sleep(1)
    print ("No infomation found.")
    sleep(1)

elif character == 'a-bomb':
    print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".")
    print ("Character found.")
    sleep(.5)
    print ("Name is A-Bomb")
    sleep(1)
    print ("Unknown if they or it are Hero or Villan.")
    sleep(1)
    print ("No infomation found")
    sleep(1)

elif character == 'a bomb':
    print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".")
    print ("Character found.")
    sleep(.5)
    print ("Name is A-Bomb")
    sleep(1)
    print ("Unknown if they or it are Hero or Villan.")
    sleep(1)
    print ("No infomation found")
    sleep(1)

elif character == 'A-bomb':
    print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".")
    print ("Character found.")
    sleep(.5)
    print ("Name is A-Bomb")
    sleep(1)

1 个答案:

答案 0 :(得分:2)

 Error creating bean with name 'beanNameHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping]: Factory method 'beanNameHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is java.lang.NoClassDefFoundError: java.time.format.FormatStyle is a restricted class. Please see the Google  App Engine developer's guide for more details.

您不需要为每个排列创建单独的from time import sleep print ("Welcome to the Marvel Database please input the name of a marvel character you want to research. Please make sure you type the name as accurately as possible.") character = input().lower() a_bomb_list = ["a-bomb", "a bomb"] if character in a_bomb_list: print ("loading", sleep(.5), ".", sleep(.5), ".", sleep(.5), ".") print ("Character found.") sleep(.5) print ("Name is A-Bomb.") sleep(1) print ("Unknown if they or it are Hero or Villan.") sleep(1) print ("No infomation found.") sleep(1) ,上面的代码适用于" a-bomb"或者"炸弹" :)