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


Python Popen.partition方法代码示例

本文整理汇总了Python中subprocess.Popen.partition方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.partition方法的具体用法?Python Popen.partition怎么用?Python Popen.partition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在subprocess.Popen的用法示例。


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

示例1: list

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import partition [as 别名]
plain = None
is_encrypted = False
found = False


gpg_block = False
for line in logs.splitlines():
    if gpg_block:
        encrypted.append(line)
        if line == '-----END PGP MESSAGE-----':
            gpg_block = False
            is_encrypted = True
            found = True
    elif line.endswith('FiWare Support:'):
        gpg_block = True
        encrypted = list()
    elif line.startswith('support:') or line.startswith('Fiware Support: '):
        password = line.partition(':')[2].strip()
        found = True
        is_encrypted = False

if is_encrypted:
    encrypted = '\n'.join(encrypted)
    print(encrypted)
    output = Popen(['gpg', '-d'], stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate(encrypted)[0]
    print(output.partition(':')[2].strip())
elif found:
    print(password)

print(server.get_vnc_console('novnc')['console']['url'])
开发者ID:Fiware,项目名称:ops.Glancesync,代码行数:32,代码来源:getpassword.py

示例2: list

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import partition [as 别名]
plain = None
is_encrypted = False
found = False 


gpg_block = False
for line in logs.splitlines():
    if gpg_block:
         encrypted.append(line)
         if line == '-----END PGP MESSAGE-----':
             gpg_block = False
             is_encrypted = True
             found = True
    elif line.endswith('FiWare Support:'):
         gpg_block = True
         encrypted = list()
    elif line.startswith('support:') or line.startswith('Fiware Support: '):
         password = line.partition(':')[2].strip()
         found = True
         is_encrypted = False

if is_encrypted:
    encrypted = '\n'.join(encrypted)
    print encrypted
    output = Popen(['gpg', '-d'], stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate(encrypted)[0]
    print output.partition(':')[2].strip(),
elif found:
    print password,

print server.get_vnc_console('novnc')['console']['url']
开发者ID:attybro,项目名称:fiware-glancesync,代码行数:32,代码来源:getpassword.py

示例3: svn_get_version

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import partition [as 别名]
def svn_get_version():
    from subprocess import Popen, PIPE
    output = Popen(["svn", "info", "mealadvisor"],
    stdout=PIPE).communicate()[0]
    return output.partition('Revision: ')[2].partition('\n')[0]
开发者ID:davedash,项目名称:mealadvisor,代码行数:7,代码来源:fabfile.py


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