반응형

Object.assign()

 

https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

 

Object.assign() - JavaScript | MDN

Object.assign() 메서드는 출처 객체들의 모든 열거 가능한 자체 속성을 복사해 대상 객체에 붙여넣습니다. 그 후 대상 객체를 반환합니다.

developer.mozilla.org

Object.assign()

Object.assign() 메서드는 출처 객체들의 모든 열거 가능 자체 속성을 복사해 대상 객체에 붙여넣습니다. 그 후 대상 객체를 반환합니다.

const target = { a: 1, b: 5 };
const source = { b: 7, c: 5 };

const returnedTarget = Object.assign(target, source);

console.log(target);
// expected output: Object { a: 1, b: 4, c: 5 }

console.log(returnedTarget);
// expected output: Object { a: 1, b: 4, c: 5 }
반응형
반응형

[python]  TypeError: expected string or bytes-like object

 

 

TypeError: expected string or bytes-like object

 

정규표현식을 사용하여 findall을 했는데, 타입에러(TypeError: expected string or bytes-like object)가 떴다.

분명 list에서도 잘 뽑아주고 정규표현식도 맞는데 왜 계속 에러가 나는거지.. 했는데 추출을 할 리스트가 string형식이 아니어서 string으로 변환. 

param1 = re.findall("[0-9]{5}", str(key))
param2 = re.findall("[A-Z]{1}[0-9]{3}", str(key))
반응형

+ Recent posts