반응형 전체 글222 Dynamic Trunking Protocol (DTP) Dynamic Trunking Protocol (DTP)는 시스코 전용 프로토콜로 두 스위치 간 trunking mode를 협상하는데 사용된다. Interface는 trunking, nontrunking, 그리고 negotiate trunking 형태로 설정할 수 있다. 마지막 negotiate trunking 방식이 DTP에 의해서 처리된다. 우선, switchport mode의 option으로는 아래와 같이 크게 3가지가 존재하는데 access: interface를 항상 지정된 VLAN만 사용 dynamic: access/trunk 여부를 DTP를 이용하여 결정 trunk: interface를 항상 trunking port로 사용 S1과 S2는 항상 trunk mode 상태를 유지한다. 반대로 S1과.. 2020. 4. 17. Python f-strings (Keep updating) Python supports string formatting three different ways. 1. %-formatting 2. str.format() 3. f-strings I have used str.format() to print data so fat but I change my mind after knowing f-strings formatting. name = 'Ethan' age = 32 print (f'My name is {name} and I am {age} years old.') name = 'Ethan' age = 32 print (f'My name is {name} and I am {age} years old.') The f-strings formatting sytax is f .. 2020. 4. 4. List comprehension Overview 파이썬에서 List comprehension의 정의는 list를 간결한 방법으로 생성하는 것을 의미한다. 아래와 같은 dev_info의 문자열로 구성된 data를 list로 만들고자 하는데 list comprehension 기능을 사용하지 않으면 두 줄 정도의 코드가 필요하다. 반대로 list comprehension을 이용한다면 한 줄로 표현할 수 있다. List를 생성함과 동시에 값을 할당하는 것이다. # [List comprehension 미사용] dev_info = ' 1.1.1.1, username, password ' item_list = [] for elem in dev_info.split(','): item_list.append(elem.strip()) # [List com.. 2020. 3. 30. Python regular expression match and search methods Long story short, match and search methods can be used whether to search the beginning of the string or the entire string. Let's dig into an example. import re data = ["ESA1-XXX-XXX - Po1", "ESA1-XXX-XXX - PO1"] for elem in data: m = re.search('(Po|PO)\d', elem).group() What I want to do is to find and replace "- Po1" or "- PO1" to "(Po1)" or "(PO1)". In order to find a certain pattern, I use re.. 2020. 3. 24. 이전 1 ··· 42 43 44 45 46 47 48 ··· 56 다음 반응형