기본 콘텐츠로 건너뛰기

12월, 2017의 게시물 표시

Gson iterate jsonobject

https://stackoverflow.com/questions/31094305/java-gson-getting-the-list-of-all-keys-under-a-jsonobject As of Gson 2.8.1 you can use  keySet() : String json = "{\"key1\":\"val\", \"key2\":\"val\"}" ; JsonParser parser = new JsonParser (); JsonObject jsonObject = parser . parse ( json ). getAsJsonObject (); Set < String > keys = jsonObject . keySet (); Since Java 8 you can use Streams as better looking alternative: String str = "{\"key1\":\"val1\", \"key2\":\"val2\"}" ; JsonParser parser = new JsonParser (); JsonObject jObj = ( JsonObject ) parser . parse ( str ); List < String > keys = jObj . entrySet () . stream () . map ( i -> i . getKey ()) . collect ( Collectors . toCollection ( ArrayList :: new )); keys . forEach ( System . out :: println ); You can use JsonParser to convert your Json into an intermedi

파이썬을 이용한 크롤링 한경 구축 python easy_install pip Selenium

참고 : https://beomi.github.io/2017/02/27/HowToMakeWebCrawler-With-Selenium/ 파이썬에 대한 기초 지식이 있는 분은 위 링크로 가능 하지만 , 생초짜인 나를 위해 하나씩 작성 함 1.윈도우 파이썬 설치 환경 : 윈도우 10 https://www.python.org/downloads/ 에서 최신 버전을 다운 받자. 2017-12-05 일 현재 최신 버전은 3.6.3 이다. 바로 다운 받는 주소는 https://www.python.org/ftp/python/3.6.3/python-3.6.3.exe 이다. all user 와 add to path 체크 해주자. 2. easy_install 설치 https://bootstrap.pypa.io/ez_setup.py 다운로드 윈도우키+R cmd 입력 도스창열고 python ez_setup.py 입력 에러가 난다 . 구글링 키워드 : python ez_setup.py ssl error 3번째 글 Python Error When Installing ez_setup.py "could not create SSL/TLS ... 거의 정확 할 듯해 답변에 보니 --insecure 옵션 붙이라는군 다시 cmd 창에 python ez_setup.py --insecure 실행 훔 또 에러. error: [WinError 5] 액세스가 거부되었습니다: 'C:\\ProgramData\\Anaconda3\\Scripts\\easy_install-script.py' 다운로드까지는 잘 되고, 엑세스 거부라니 ... ㅠㅠ . 다시 구글링 키워드 : error: [WinError 5] 액세스가 거부되었습니다: 'C:\\ProgramData\\Anaconda3\\Scripts\\easy_install