new_words = [ word for word_list in words for word in word_list if len(word) > 4]
for i in v:
for j in i:
print(j)
[j for i in v for j in i]
출처: https://somjang.tistory.com/entry/Python-이중-for-문-한-줄로-작성하는-방법
출처: https://bigdaheta.tistory.com/14
'Python' 카테고리의 다른 글
이터레이터에서 왜 __iter__를 선언할까? (0) | 2022.11.25 |
---|---|
리눅스(CentOS) GPU 사용 시 메모리 오류 (0) | 2022.11.18 |
백준 1152번 - 단어의 개수 (0) | 2022.09.29 |
REPL 사용, 특정 경로 파일 카운트 (0) | 2022.09.26 |
[예외처리] 가정설정문 assert (0) | 2022.09.23 |