本文整理汇总了Python中pip._vendor.six.moves.input方法的典型用法代码示例。如果您正苦于以下问题:Python moves.input方法的具体用法?Python moves.input怎么用?Python moves.input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip._vendor.six.moves
的用法示例。
在下文中一共展示了moves.input方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ask
# 需要导入模块: from pip._vendor.six import moves [as 别名]
# 或者: from pip._vendor.six.moves import input [as 别名]
def ask(message, options):
"""Ask the message interactively, with the given possible responses"""
while 1:
if os.environ.get('PIP_NO_INPUT'):
raise Exception(
'No input was expected ($PIP_NO_INPUT set); question: %s' %
message
)
response = input(message)
response = response.strip().lower()
if response not in options:
print(
'Your response (%r) was not one of the expected responses: '
'%s' % (response, ', '.join(options))
)
else:
return response
示例2: ask
# 需要导入模块: from pip._vendor.six import moves [as 别名]
# 或者: from pip._vendor.six.moves import input [as 别名]
def ask(message, options):
# type: (str, Iterable[str]) -> str
"""Ask the message interactively, with the given possible responses"""
while 1:
if os.environ.get('PIP_NO_INPUT'):
raise Exception(
'No input was expected ($PIP_NO_INPUT set); question: %s' %
message
)
response = input(message)
response = response.strip().lower()
if response not in options:
print(
'Your response (%r) was not one of the expected responses: '
'%s' % (response, ', '.join(options))
)
else:
return response