[JS] lodash란? 유용한 메소드와 사용법까지
lodash? - JS(JavaScript)의 라이브러리 중 하나로 설치하여 사용할 수 있다. - _ 기호를 사용한다 - 데이터를 쉽게 다룰 수 있게 한다. - frontend에서 자주 사용하며 코드를 줄여주고 빠른 작업이 가능하다. npm, yarn 으로 설치 npm i -g npm npm i --save lodash yarn add lodash 공통으로 사용할 테스트 변수 const fruits1 = [ {name:"kiwi",color:"green",count:2}, {name:"banana",color:"yellow",count:5}, {name:"apple",color:"green",count:2}, {name:"apple",color:"red",count:3} ] const fruits2 = ..
2023. 6. 8.
[Python] String 을 List 형식으로 바꾸는 방법, String to List(+ String List to List)
1. str.split('seperator') List 로 변환할 때 구분할 수 있는 Seperator 가 있는 경우 사용 split() 에서 괄호 사이에 '/', ';' 등 구분자가 되는 기호나 문자를 넣으면 그 구분자를 기준으로 List 로 만들어 줌 str = 'apple, orange, banana' pring( str.split(',') ) >> ['apple', 'orange', 'banana'] 2. list(str) String 의 모든 글자를 하나씩 쪼개어 List 를 만들 때 사용 str = 'apple, banana' print( list(str) ) >> ['a', 'p ', 'p', 'l', 'e', ',', ' ', 'b', 'a', 'n', 'a', 'n', 'a'] 2. js..
2022. 12. 16.