Python/개념학습

collections 모듈 - extend, append

수e 2022. 8. 21. 12:04

in collections.deque

# 예제3-2. append() vs extend()

lst2 = ['a', 'b', 'c', 'd']
lst.extend('ef') # extend()
lst2.append('ef') # append() 


print("lst.extend('ef') >> ", lst)
print("lst2.append('ef') >>", lst2)
'''

결과
lst.extend('ef') >> ['a', 'b', 'c', 'd', 'e', 'f']
lst2.append('ef') >> ['a', 'b', 'c', 'd', 'ef']

 

reference: https://excelsior-cjh.tistory.com/entry/collections-모듈-deque [EXCELSIOR:티스토리]