book_room.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:roomfinder 作者: GuillaumeMorini 项目源码 文件源码
def where():
    j = request.get_json()
    if "room" not in j:
        return "Sorry, no room where specified !"
    room=str(j["room"])
    sys.stderr.write("room: "+room+"\n")
    rooms=findRooms(prefix=room,anywhere=True)
    sys.stderr.write("rooms: "+str(rooms)+"\n")
    # if len(rooms)==1:
    #     reply="Here is the full name of the room: \n * "+str(rooms.items()[0][1])
    # else:
    #     reply="Do you mean:\n"
    #     for r in rooms:
    #         reply+="* "+str(rooms[r])+"\n"
    reply=""
    if len(rooms)==0:
        return "Sorry, no room with this name found !"
    for r in rooms:
        reply+=str(rooms[r])+";"
    return reply[0:len(reply)-1]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号