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


Python Popen.match方法代码示例

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


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

示例1: FeatureCompute

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import match [as 别名]
def FeatureCompute(currentdirname):
    for (thisDir, subsHere, filesHere) in os.walk(currentdirname):
        for filename in filesHere:
            (shortname, extension) = os.path.splitext(filename)
            pcapfullname = os.path.join(thisDir,filename)
            #featurefilename = 
            if( os.path.isfile(pcapfullname) and (extension==".pcap" or extension == ".PCAP" ) ):
                #fullfeaturefilename=pcapfullname+".arff"
                #cmd1_s= "rm %s" % (APPCONFIG.GlobalConfig['tmp_arff_filename'])
                if os.path.isfile(APPCONFIG.GlobalConfig['tmp_arff_filename']):
                    os.remove(APPCONFIG.GlobalConfig['tmp_arff_filename'])
                cmd1_s='OpenDPI_demo -f %s' % pcapfullname
                p = Popen(cmd1_s, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT,close_fds=True)
                output = p.stdout.read()
                prog=re.compile("###.*###")
                m = prog.search(output)
                p = re.compile('[a-zA-Z0-9,[email protected]#_]')
                app_str_limited=''
                for i in m.group(0):
                    if p.match(i):
                        app_str_limited+=i
                    else:
                        app_str_limited+='='
                appfilename=pcapfullname+"."+app_str_limited+".arff"
                logging.info ("computing feature to: %s" % appfilename)
                cmd2_s= "netmate -f %s" % (pcapfullname )
                cmd3_s= "mv %s %s"%(APPCONFIG.GlobalConfig['tmp_arff_filename'],appfilename)
                #os.system(cmd1_s)
                #os.system(cmd2_s)
                #os.system(cmd3_s)
                allcmd_s=("%s && %s"%(cmd2_s,cmd3_s))
                os.system(allcmd_s)
            else:
                logging.info ("%s is not a directory" % pcapfullname )
                pass
开发者ID:flykeysky,项目名称:flowsing,代码行数:37,代码来源:flowsing.py

示例2: Popen

# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import match [as 别名]
#!/bin/python

import re
import subprocess
from subprocess import Popen
p = Popen(["xsel", "-o"], stdout=subprocess.PIPE)
output, err = p.communicate()
out = str(output).replace("b'", "").replace("\\n'", "")
words = out.split(" ")

p = re.compile(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.-]*)*\/?")
for word in words:
	#print(word)
	#print(p.findall(word))
	if p.match(word) != None:
	#	print(word)
		subprocess.call(["xdg-open", word])
开发者ID:Nolanfaught,项目名称:settings,代码行数:19,代码来源:linkopen.py


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