본문 바로가기

전체 글102

python에서 yaml 파일 사용하기 yaml이란? yaml은 야믈이라고 읽으며 yml로 쓰기도 한다. JSON, XML과 같은 데이터 전송 형식이며, JSON과 XML에 비해 표현 양식이 간편하고 사람이 알아보기 쉬워서 많이 사용한다. 주로 config.yaml 파일을 yaml 형식으로 만들고 python 파일에서 yaml 파일을 import 해서 사용한다. key-value 형식으로 구성 되며 list 형식을 포함할 수 있다. 예시 사용 예시 # config.yaml # info.yaml language: python test: pytest # python_prac.py import yaml with open('info.yaml') as f: conf = yaml.safe_load(f) language = conf['language'] .. 2022. 1. 18.
vscode에서 모듈 import 안될 때 python3 -m pip install absl-py 와 같이 python3 -m을 앞에 붙인다. vscode : python3 -m pip install tqdm jupyter notebook : !pip install tqdm 2021. 8. 20.
[React] Class Components and State dynamic data : 변하는 데이터 state : object. 바꾸고 싶은 데이터를 state 안에 넣는다. function App() --> class App extends React.Component로 변경 (function component --> class component) React.Component는 return이 없고 render method가 있음 render method에서 return 실행 Class component는 render method 자동 실행 class component는 state를 가지고 있기 때문에, function component가 아닌 class component 사용 state를 선언하고 render()에서 {this.state.count} 형식으로 구.. 2020. 7. 27.
[React] Protection with PropTypes foodILike list에 rating 추가 terminal > npm i prop-types (설치) package.json > dependencies > prop-types가 있으면 설치 완료! prop-types : 우리가 원하는 component가 맞는지 확인 시켜준다. App.js > import PropTypes from "prop-types"; App.js > Food.propTypes 정보 추가 (type, required 여부) 참고 https://ko.reactjs.org/docs/typechecking-with-proptypes.html PropTypes와 함께 하는 타입 확인 – React A JavaScript library for building user interfaces k.. 2020. 7. 27.
[React] Map Recap Food에 id 추가 id를 추가해야 에러 발생하지 않음 import React from 'react'; function Food({name, picture}) { return I like {name} } const foodILike =[ { id: 1, name: "Kimchi", image: "http://aeriskitchen.com/wp-content/uploads/2008/09/kimchi_bokkeumbap_02-.jpg" }, { id: 2, name: "Samgyeopsal", image: "https://3.bp.blogspot.com/-hKwIBxIVcQw/WfsewX3fhJI/AAAAAAAAALk/yHxnxFXcfx4ZKSfHS_RQNKjw3bAC03AnACLcBGAs/s400/DSC.. 2020. 7. 27.