嗨!我试图在python 2.7中创建一个会话机器人

时间:2017-05-13 07:44:04

标签: python-2.7

import os,time
import random
import sys

namea = ['what is your name','whats your name','what is your name?','whats your name?']
greeta = ['hello','hi','hi there','hello there']
birth = ['what is your date of birth','what is your date of birth?','what is your DOB','what is your DOB?']
botmaster = ['who is your botmaster','who is your botmaster?','who is your father','who is your mother']
greetb = ['hi there','hello','hi my name is Ananymous','hello there']
nameb = ['I am called Ananymous','my name is Ananymous','I am called Ananymous']

K = '\n\n\n\n\n\n\n\n\n\n\n\n Ananymous \n\n onnline...........'
print(K)
while True:
    C = raw_input('$').strip()
    Cbot =C.bot()

    if C == '':
            print '$ Bye'
            time.sleep(1)
            os.system("sudo shutdown -h now")
            break
    elif Cbot in namea:
            print '$' + (random.choice(nameb))
    elif Cbot in greeta:
            print '$' + (random.choice(greetb))
    elif Cbot in botmaster:
            print [('$ My botmaster Kumar')]
    elif Cbot in birth:
            print [('$ My Birthdate Is May 8 2017')]
    C.bot()

这是我的编码,它会抛出一个错误:

Traceback (most recent call last):
  File "ananymous.py", line 16, in <module>
    Cbot =C.bot()
AttributeError: 'str' object has no attribute 'bot'

0 个答案:

没有答案