Skip to content

Commit

Permalink
Update netstat.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sohwaje authored May 12, 2020
1 parent 65fd7d4 commit 36233d2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions netstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ def main():
print(templ % (
"Proto", "Local address", "Remote address", "Status", "PID",
"Program name"))
proc_names = {}
for p in psutil.process_iter(['pid', 'name']):
proc_names[p.info['pid']] = p.info['name']
proc_names = {} # 딕셔너리 자료형 초기화
for p in psutil.process_iter(['pid', 'name']): # pid와 name을 info의 속성으로 지정
proc_names[p.info['pid']] = p.info['name'] # 딕셔너리에 'pid':'name' 쌍으로 추가
"""
proc_names 딕셔너리에 'pid':'name' 쌍 추가한다.
ex)
proc_names={}
a = 'a'
Expand Down

0 comments on commit 36233d2

Please sign in to comment.