반응형
Python에서 목록을 * args
로 어떻게 변환합니까?
기능이
scikits.timeseries.lib.reportlib.Report.__init__(*args)
몇 개의 time_series 객체가 * args
로 전달되기를 원하지만 나는 timeseries 객체 목록이 있습니다.
해결 방법
iterable 전에 *
연산자를 사용하여 함수 호출 내에서 확장 할 수 있습니다. 예를 들면 :
timeseries_list = [timeseries1 timeseries2 ...]
r = scikits.timeseries.lib.reportlib.Report(*timeseries_list)
( timeseries_list
앞에 *
주의)
* expression 구문이 함수 호출에 나타나면 expression must evaluate to an iterable. Elements from this iterable are treated as if they were additional positional arguments; if there are positional arguments x1, ..., xN, and expression evaluates to a sequence y1, ..., yM, this is equivalent to a call with M+N positional 인수 x1, ..., xN, y1, ..., yM.
참조 페이지 https://stackoverflow.com/questions/3941517
반응형
'파이썬' 카테고리의 다른 글
파이썬 Python Pandas Group by date using datetime data (0) | 2020.10.31 |
---|---|
파이썬에서 목록을 어떻게 되돌릴 수 있습니까? (0) | 2020.10.31 |
파이썬 set ([])은 두 객체가 같은지 어떻게 확인합니까? 이것을 사용자 정의하기 위해 객체는 어떤 메소드를 정의해야합니까? (0) | 2020.10.30 |
파이썬 Python unittest를 사용하여 파일을 작성하는 함수의 단위 테스트를 수행하는 방법 (0) | 2020.10.30 |
파이썬 UnicodeEncodeError : 'latin-1'코덱은 문자를 인코딩 할 수 없습니다. (0) | 2020.10.30 |
댓글