728x90

1. dictionary merge/update

a, b : dictionary

c = a|b  # merge a with b, right always win if key conflicts, a,b 모두 합치되 common key에 대한 value는 b에 것 사용

a |= b  # update a, a와 b모두에 있는 key는 b에서의 value로 update, a에만 있는 key는 그대로 유지

 

 

2. remove prefix/suffix of strings

a : string

a.removeprefix(prefix)  # a가 입력한 prefix로 시작한다면 그것을 slicing으로 제외한 결과를 return

a.removesuffix(suffix)  # a가 입력한 suffix로 끝나면 그것을 slixing으로 제외한 결과를 return

 

3. Type hinting for built-in generic types

type hinting에서 generic type에 대한 지원이 추가

Type hin

 

728x90

+ Recent posts