JIRA: BOTTLENECKS-29
[bottlenecks.git] / vstf / vstf / common / input.py
1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 __author__ = 'wly'
11 __version__ = '0.1'
12
13 import os
14
15
16 def raw_choice(title):
17     ret = {'Y': True, 'N': False}
18     while True:
19         os.system("clear")
20         in_str = "\n%s:(y|n)  " % title
21         uin = raw_input(in_str).title()
22         if uin in ['Y', 'N']:
23             break
24     return ret[uin]