๐ฉ๐ป๐ป/python3 [python] TypeError: 'type' object is not subscriptable โ ๊ฐ์ python3.8 ํ๊ฒฝ์์ ์ฝ๋๋ฅผ ์คํ์ํค๋ ์๋์ ๊ฐ์ ์๋ฌ์ ํจ๊ป ์คํ์ด ์๋์๋คTypeError: 'type' object is not subscriptable ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ ์ง์ ์ ๋ณด๋def test_function1() -> list[str]: ... def test_function2() -> dict: ํ์ ํํธ๋ฅผ ์ง์ ํ ๋ ์๊ธฐ๋ ์ค๋ฅ์์ธ์ ํ์ธํด๋ณด๋, typing ํํธ๋ python3.9๋ถํฐ ์ง์ํ๊ณ ์๋ค โ ๋ฐฉ๋ฒ 1์ฌ์ฉํ๋ python ์ 3.9๋ก ์ ๋ฐ์ดํธํ๋ ๋ฐฉ๋ฒ์ด ์๊ณ โ ๋ฐฉ๋ฒ2python typing ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ฌ ์ง์ ํด์ฃผ๋ฉด ๋๋ค.python ๋ฒ์ ์ ์ ํฐ ๋ง ๋จน๊ณ ํด์ผํ๋ ์ด ๋ฐฉ๋ฒ์ ๊ฐ์ถํ๋ค.from typing import List, Dictdef test_.. 2024. 5. 2. [python] Received response with content-encoding: gzip, but failed to decode it. ์๋ฌ : Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect data check') res = requests.get( page_url, headers={ 'User-Agent': utils.get_random_agent() }, timeout=10 ) content = res.content ์์ ๊ฐ์ด ์์ฒญ์, ์๋์ ๊ฐ์ ๋ฉ์ธ์ง์ ํจ๊ป ํฌ๋กค๋ง์ด ์งํ์ด ๋ถ๊ฐํ ์ํฉ์ด ๋ฐ์ํ๋ค. # error Received response with content-encoding: gzip, but failed to decode it.', error(.. 2024. 2. 19. [python] ๋ค์ด๋ฒ ์นดํ ํฌ๋กค๋ง ๋ค์ด๋ฒ ์นดํ ๊ฒ์๊ธ์ ํฌ๋กค๋ง ํ๋ ค ํ๋ค. python requests๋ฅผ ์ด์ฉํด์ ๊ฐ์ง๊ณ ์ค๋ ค๊ณ ํ์ผ๋ ํ์๋์ ์์ ํ ์๋น์ค ์ด์ฉ์ ์ํด ๋น๋ฐ๋ฒํธ๋ฅผ ํ์ธํด ์ฃผ์ธ์. IP๊ฐ ์์ฃผ ๋ณ๊ฒฝ๋๋ ๋คํธ์ํฌ ํ๊ฒฝ์์ ๋ก๊ทธ์ธํ๋ ๊ฒฝ์ฐ IP๋ณด์์ ํด์ ํ ์ด์ฉํ์๊ธฐ ๋ฐ๋๋๋ค. ๋ค์ ํ๋ฒ ๋น๋ฐ๋ฒํธ ํ์ธ ํ์๋ฉด ์ด์ฉ์ค์ธ ํ๋ฉด์ผ๋ก ๋์๊ฐ๋ฉฐ, ์์ฑ ์ค์ด๋ ๋ด์ฉ์ ์ ์์ ์ผ๋ก ์ ์ก ๋๋ ๋ฑ๋กํ์ค ์ ์์ต๋๋ค. ์ด๋ ๊ฒ ์ ๊ทผํ ์ ์์์ ์ ์ ์๋ค. ์ด๋ ๊ฒ ๋๋ฉด selenium์ ์ด์ฉํด์ ๋์ ์ผ๋ก ์ ๊ทผํ๊ธฐ๋ก ํ๋ค. ๋ก๊ทธ์ธ id ์ password๋ฅผ ์ ๋ ฅํด์ ์๋์ ์ฝ๋๋ฅผ ์คํํ๋ฉด ๋ก๊ทธ์ธ์ด ์งํ๋จ์ ์ ์ ์๋ค. import time from selenium import webdriver import csv import pandas .. 2024. 1. 30. ์ด์ 1 ๋ค์