정규식

언어/python2018. 10. 16. 11:06

import re

def main():

    f = re.compile('[A-Z]:')

    s = '"C:\\Windows\\system32\\NOTEPAD.EXE" C:\\Users\\kitri\\Desktop\\설치목록.txt'

    s = re.sub('[", ' ']', '', s)

    # print (s)

    indexList = []

    for i in f.finditer(s):

        indexList.append(i.span()[0])

    indexList.append(len(s))

    print (indexList)


    for i in range(0, len(indexList)-1):

        print (s[indexList[i]:indexList[i+1]])



if __name__ == "__main__":

    main()

'언어 > python' 카테고리의 다른 글

네이버 영화 크롤링 파이썬  (0) 2018.10.20
python watchdog 공부  (0) 2018.10.20
virusshare malware hash crawling python  (0) 2018.10.12
python winlog event  (0) 2018.10.10
python + 사람인  (0) 2018.10.09