map(), filter(), pipe()를 활용하여 데이터 다루기
map(), filter() 함수는 리스트 안의 데이터를 내가 원하는 대로 추출하거나 변형시킬 수 있습니다.def square(num): return num**2number_list = [1, 2, 3, 4, 5]result = map(square, number_list)print(result) # # for loop -> [1, 4, 9, 16, 25]print(list(result)) # [1, 4, 9, 16, 25]# 람다result = list(map(lambda x: x**2, number_list))print(result) # [1, 4, 9, 16, 25]map()의 리턴 데이터 타입은 map objectfilter() 또한 filter object 리스트 to 리스트를 통해 DB에..
2024. 4. 8.
UploadFile, 이미지 form-data
이미지 등의 파일을 업로드할 때는 form-data로 데이터를 받습니다."file": { "filename": "test.jpg", "file": { "_file": {}, "_max_size": 1048576, "_rolled": false, "_TemporaryFileArgs": { "mode": "w+b", "buffering": -1, "suffix": null, "prefix": null, "encoding": null, "newline": null, "dir": null, "er..
2024. 3. 28.