当前位置: 首页>>代码示例>>Python>>正文


Python utils.ask函数代码示例

本文整理汇总了Python中utils.ask函数的典型用法代码示例。如果您正苦于以下问题:Python ask函数的具体用法?Python ask怎么用?Python ask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ask函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: q1

def q1():
    answer = ask(c.red + 'Question 1: What colour are the unicorns?')
    if answer == "pink":
        print('And what a lovely color it is')
        return True
    print('That is incorrect')
    return False
开发者ID:ozjack,项目名称:python-1,代码行数:7,代码来源:pink.py

示例2: q2

def q2():
    7 = ask('how much damige does a diamond
    sowrd do im in the bad spellers club')
    if  rainbows.startswith("7"):
        print('good job!!!!!!!!!!!!!!!')
        return True
    return False
开发者ID:b8conbomber,项目名称:python-1,代码行数:7,代码来源:minecraft.py

示例3: q3

def q3():
    answer = ask("What famous youtuber made a shoutout to him")
    if answer.startswith("pewdipie"):
         print(":)")
         return True
    print(":<")
    return False
开发者ID:iamdurza,项目名称:python-1,代码行数:7,代码来源:thebaws.py

示例4: set_deep_meta_attr_node

def set_deep_meta_attr_node(target_node, attr, value):
    nvpair_l = []
    if xmlutil.is_clone(target_node):
        for c in target_node.iterchildren():
            if xmlutil.is_child_rsc(c):
                rm_meta_attribute(c, attr, nvpair_l)
    if config.core.manage_children != "never" and \
            (xmlutil.is_group(target_node) or
             (xmlutil.is_clone(target_node) and xmlutil.cloned_el(target_node) == "group")):
        odd_children = get_children_with_different_attr(target_node, attr, value)
        for c in odd_children:
            if config.core.manage_children == "always" or \
                    (config.core.manage_children == "ask" and
                     utils.ask("Do you want to override %s for child resource %s?" %
                               (attr, c.get("id")))):
                common_debug("force remove meta attr %s from %s" %
                             (attr, c.get("id")))
                rm_meta_attribute(c, attr, nvpair_l, force_children=True)
    xmlutil.rmnodes(list(set(nvpair_l)))
    xmlutil.xml_processnodes(target_node,
                             xmlutil.is_emptynvpairs, xmlutil.rmnodes)

    # work around issue with pcs interoperability
    # by finding exising nvpairs -- if there are any, just
    # set the value in those. Otherwise fall back to adding
    # to all meta_attributes tags
    nvpairs = target_node.xpath("./meta_attributes/nvpair[@name='%s']" % (attr))
    if len(nvpairs) > 0:
        for nvpair in nvpairs:
            nvpair.set("value", value)
    else:
        for n in xmlutil.get_set_nodes(target_node, "meta_attributes", 1):
            xmlutil.set_attr(n, attr, value)
    return True
开发者ID:icclab,项目名称:crmsh,代码行数:34,代码来源:ui_resource.py

示例5: do_weak_bond

    def do_weak_bond(self, context, *nodes):
        '''
        Create a 'weak' colocation:
        Colocating a non-sequential resource set with
        a dummy resource which is not monitored creates,
        in effect, a colocation which does not imply any
        internal relationship between resources.
        '''
        if len(nodes) < 2:
            context.fatal_error("Need at least two arguments")

        for node in nodes:
            obj = cib_factory.find_object(node)
            if not obj:
                context.fatal_error("Object not found: %s" % (node))
            if not xmlutil.is_primitive(obj.node):
                context.fatal_error("Object not primitive: %s" % (node))

        constraint_name = self.make_unique_name('place-constraint-')
        dummy_name = self.make_unique_name('place-dummy-')
        print "Create weak bond / independent colocation"
        print "The following elements will be created:"
        print "   * Colocation constraint, ID: %s" % (constraint_name)
        print "   * Dummy resource, ID: %s" % (dummy_name)
        if not utils.can_ask() or utils.ask("Create resources?"):
            cib_factory.create_object('primitive', dummy_name, 'ocf:heartbeat:Dummy')
            colo = ['colocation', constraint_name, 'inf:', '(']
            colo.extend(nodes)
            colo.append(')')
            colo.append(dummy_name)
            cib_factory.create_object(*colo)
开发者ID:icclab,项目名称:crmsh,代码行数:31,代码来源:ui_assist.py

示例6: q3

def q3():
    answer =ask(c.magenta + 'should narwhals be the dominant species of the world?')
    if answer == 'yes':
        print('yyyeeeeeaaaahhhh')
        return True
    print('eradicate from the world, }:(========')
    return False
开发者ID:lewington3348,项目名称:python-1,代码行数:7,代码来源:narwhals.py

示例7: q1

def q1():
    answer = ask(c.orange + 'What are the swaggiest animals ever?' + c.reset) 
    if answer =='narwhals':
        print('so nice and purty')
        return True
    print('incorect :(======')
    return False
开发者ID:lewington3348,项目名称:python-1,代码行数:7,代码来源:narwhals.py

示例8: q3

def q3():
    answer = ask("What number is this:1000000?")
    if answer == "1 million":
        print(":)")
        return True
    print(":<")
    return False
开发者ID:jakedasupersnake,项目名称:python-1,代码行数:7,代码来源:myquiz.py

示例9: q1

def q1():
    answer = ask("What is the hardest color to get?")
    if answer == "black":
        print(":)")
        return True
    print(":<")
    return False
开发者ID:lavakiller123,项目名称:python-1,代码行数:7,代码来源:gd.py

示例10: q2

def q2():
    answer = ask("How many letters on a keyboard?")
    if answer == "26":
        print("Super.")
        return True
    print("Nope")
    return False
开发者ID:jakedasupersnake,项目名称:python-1,代码行数:7,代码来源:myquiz.py

示例11: q1

def q1():
    answer = ask("What color are deh Unicorns?")
    if answer == "pink":
        print(derpynessrules.yellow + "Correct! You got it right. Now try to get the next one right!")
        return True
    print(derpynessrules.blue + "Oh no! You got it wrong! Try it again.")
    return False 
开发者ID:GDashBoss,项目名称:python-1,代码行数:7,代码来源:unicornsrule.py

示例12: q3

def q3():
    answer = ask("Use one word to descride their magical fur?")
    if answer.startswith("smiles"):
        print(derpynessrules.yellow + "Correct! You got it right. This is the end of this quiz YEAH!:)")
        return True
    print(derpynessrules.blue + "Oh no! You got it wrong! Try it again.:<")
    return False 
开发者ID:GDashBoss,项目名称:python-1,代码行数:7,代码来源:unicornsrule.py

示例13: q2

def q2():
    answer = ask("What are deh Unicorns dancing on?")
    if answer.startswith("rainbow"):
        print(derpynessrules.yellow + "Correct! You got it right. Now try to get the next one right!")
        return True
    print(derpynessrules.blue + "Oh no! You got it wrong! Try it again.")
    return False 
开发者ID:GDashBoss,项目名称:python-1,代码行数:7,代码来源:unicornsrule.py

示例14: q1

def q1():
    answer = ask("What color are the unicors?") 
    if answer == "pink":
        print("And what a lovely color it is.")
        return True
    print("That is incorrect.")
    return False
开发者ID:iamdurza,项目名称:python-1,代码行数:7,代码来源:fluffy.py

示例15: q2

def q2():
    answer = ask("What level is the hardest of them all?")
    if answer.startswith("theory of everything 2"):
        print(":)")
        return True
    print(":<")
    return False
开发者ID:lavakiller123,项目名称:python-1,代码行数:7,代码来源:gd.py


注:本文中的utils.ask函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。