本文整理匯總了Python中pyparsing.White方法的典型用法代碼示例。如果您正苦於以下問題:Python pyparsing.White方法的具體用法?Python pyparsing.White怎麽用?Python pyparsing.White使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyparsing
的用法示例。
在下文中一共展示了pyparsing.White方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _globalParse___ssh_attributes
# 需要導入模塊: import pyparsing [as 別名]
# 或者: from pyparsing import White [as 別名]
def _globalParse___ssh_attributes(line):
ssh_dict = {}
ssh_option = (Word(alphas + '-'))('option')
ssh_value = (restOfLine) ('value')
result = (ssh_option + White() + ssh_value).parseString(line)
if result.option == 'logging':
ssh_dict['logging-events'] = 'yes'
elif result.option == 'authentication-retries':
ssh_dict['authentication_retries'] = result.value.split()[0]
elif result.option == 'port':
ssh_dict['port_rotary'] = result.value.split()[0]
elif result.option == 'maxstartups':
ssh_dict['maxstartups'] = result.value.split()[0]
elif result.option == 'time-out':
ssh_dict['time-out'] = result.value.split()[0]
elif result.option == 'version':
ssh_dict['version'] = result.value.split()[0]
return ssh_dict
示例2: get_attributes
# 需要導入模塊: import pyparsing [as 別名]
# 或者: from pyparsing import White [as 別名]
def get_attributes(config):
options_list = []
option = White(exact=1) + Suppress(Optional(White())) + restOfLine
next_line = config.readline()
try:
option_parse = option.parseString(next_line)
while option_parse[0] == ' ':
options_list.append(option_parse[-1])
next_line = config.readline()
option_parse = option.parseString(next_line)
except:
pass
return options_list, next_line