Python/Python for Windows

[Python] Check shared folder of Windows operating system using subprocess and regular expression

Pydole 2018. 5. 4. 13:14

파이썬 subprocess와 정규식을 이용한 윈도우 운영체제 공유폴더 점검

 

import subprocess
import re

p = re.compile('\w+[$]')

for x in subprocess.check_output('net share').split():
    p1 = p.findall(str(x))
    if p1:
        print(p1)
--------------------------------------------------------
['C$']
['IPC$']
['ADMIN$']