목록의 값을 정규식 패턴과 일치 시키려고합니다. 목록 내의 특정 값이 일치하면이를 다른 dicts 목록에 추가합니다. 위에서 언급 한 값이 일치하지 않으면 목록에서 값을 제거하고 싶습니다.subprocess.check_output의 필터 출력
import subprocess
def list_installed():
rawlist = subprocess.check_output(['yum', 'list', 'installed']).splitlines()
#print rawlist
for each_item in rawlist:
if "[\w86]" or \
"noarch" in each_item:
print each_item #additional stuff here to append list of dicts
#i haven't done the appending part yet
#the list of dict's will be returned at end of this funct
else:
remove(each_item)
list_installed()
최종 목표는 결국 비슷한 할 수있을 것입니다 : 이것은 결국 더 큰 시스템 관리자 프론트 엔드로 성장할 것입니다 : GNU에
nifty_module.tellme(installed_packages[3]['version'])
nifty_module.dosomething(installed_packages[6])
주/리눅스 사용자는 태권도 연맹 것이다.
하지만 무엇이 문제입니까? – Vicent