美文网首页
Python 字符串匹配

Python 字符串匹配

作者: 资源的搬运工 | 来源:发表于2019-01-03 17:42 被阅读0次

import os

import sys

import string

# fun2

def get_all_pod_spec():

path = os.path.expanduser('~/lazada_prj/Lazada4iPhone/Pods/')

return os.listdir(path)

# fun2

def getpods():

podspecs = get_all_pod_spec()

print (len(podspecs))

path = os.path.expanduser('~/lazada_prj/Lazada4iPhone/Pods/')

for specin podspecs:

subFrameworkPath = os.path.join(path, spec)

if os.path.isfile(subFrameworkPath):

print spec

continue

        subFile = os.listdir(subFrameworkPath)

for childFWin subFile:

if string.find(childFW,'.framework') != -1:

gfilePath = os.path.join(subFrameworkPath,childFW)

gfiles = os.listdir(gfilePath)

for gfilein gfiles:

gfilename = childFW.replace('.framework','')

if gfile==gfilename:

nmpath = os.path.join(gfilePath,gfile)

syscommnd ='nm -U '+nmpath

output = os.popen(syscommnd, 'r')

frameworkC = output.read()

if readstdcxxOnly(frameworkC,childFW) =='find':

continue

def readstdcxxOnly(frameworkContent,framename):

path = os.path.expanduser('~/libstcxx/libstdcxx.txt')

fopen =open(path,'r')

stdcxxContentLines = fopen.readlines()

counti=1

    for templinein stdcxxContentLines:

contentLine = templine.replace(' ','')

contentLine = contentLine.replace('\n', '')

contentLine = contentLine.replace(',', '')

contentLine = contentLine.replace('[', '')

contentLine = contentLine.replace(']', '')

contentLine = contentLine.replace('"', '')

counti = counti+1

        if len(contentLine)<3:

continue

        if string.find(frameworkContent,contentLine) != -1:

print framename+'---include libstdcxx---:'+contentLine

return 'find'

    print 'notFount--'+framename

return 'NotFind'

# fun2

def main(argv):

getpods()

# fun2

if __name__ =='__main__':

main(sys.argv)

相关文章

  • Django URL传参

    1. 正则表达式匹配传参: 链接网页形如:/list/python/时,通过正则表达式匹配到字符串"python"...

  • 第十七章 Phton3 正则模块(标准库)

    常用特殊字符匹配内容 字符匹配: 次数匹配: Python 中使用正则的方法 match 只在整个字符串的起始位置...

  • RegExp Cheatsheet

    正则匹配技巧 使用python包re 基本函数 re.match(正则表达式, 原字符串) 从最开始匹配,但只匹配...

  • Python中的字符串

    Python中的字符串 对Python中的字符串常用函数的笔记, 方便查用. 格式化操作符% %通过匹配不同的字符...

  • 判断一个字符串是否是合法ip

    此题目可以使用正则表达式匹配或者字符串匹配方法进行判断 思路: python2.7正则表达式解法: python2...

  • python正则表达式简要

    python 中使用正则表达式 re.match只匹配字符串的开始,如果字符串开始不符合正则表达式,则匹配失败,函...

  • 正则表达式

    作用:用来匹配字符串。 在Python中,正则表达式是特殊的字符序列,检查一个字符串是否与某种模式匹配。 格式-...

  • Python -- 正则表达式 regular express

    作用:用来匹配字符串。 在Python中,正则表达式是特殊的字符序列,检查一个字符串是否与某种模式匹配。 格式-...

  • python字符串和文本

    Python CookBook总结 用Shell 通配符匹配字符串 你想使用Unix Shell 中常用的通配符(...

  • 正则表达式-全角字符串的匹配

    正则表达式-全角字符串的匹配 前段时间在用Python爬取网站, 有一个字符串怎么也匹配不了,放到Notepad+...

网友评论

      本文标题:Python 字符串匹配

      本文链接:https://www.haomeiwen.com/subject/ebrqrqtx.html