티스토리 뷰

공부

[Python] Check array out of range

승가비 2020. 2. 9. 02:57
728x90
try:
    b = a[4]
except IndexError:
    b = 'sss'

[reference] https://stackoverflow.com/questions/2574636/getting-a-default-value-on-index-out-of-range-in-python

728x90

'공부' 카테고리의 다른 글

[Shell] Get date before 1 hour  (0) 2020.02.09
[Shell] Sizeof byte file  (0) 2020.02.09
[Python] Selenium clear cache  (0) 2020.02.09
[Python] Selenium in private mode  (0) 2020.02.09
[JS] Sort object property  (0) 2020.02.09
댓글