아래와 같이 복사 해서 실행하였는데 결과는 에러가 나옵니다. 도와 주세요.. < html > < body > < div id = " foods " > < h1 > 안주 및 주류 < ul id = " fd-list " > < li class = " food hot " data-lo = " ko " > 닭 도리탕 < li class = " food " data-lo = " jp " > 돈까스 < li class = " food hot " data-lo = " ko " > 삼겹살 < li class = " food " data-lo = " us " > 스테이크 < ul id = " ac-list " > < li class = " alcohol " data-lo = " ko " > 소주 < li class = " alcohol " data-lo = " us " > 맥주 < li class = " alcohol " data-lo = " ko " > 막걸리 < li class = " alcohol high " data-lo = " cn " > 양주 < li class = " alcohol " data-lo = " ko " > 동동주 Traceback (most recent call last): File "/Users/Apple/section2/download2-6-2.py", line 14, in print("1", soup.select("li:nth-of-type(4)")[1].string) #각 li 태그 그룹의 4번째 요소 선택 IndexError: list index out of range [Finished in 0.659s] 첨부 파일 복사본 from bs4 import BeautifulSoup import sys import io sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8') sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8') fp = open("food-list.html",encoding="utf-8") soup = BeautifulSoup(fp, "html.parser") print(soup) print("1", soup.select("li:nth-of-type(4)")[1].string) #각 li 태그 그룹의 4번째 요소 선택 print("2", soup.select_one("#ac-list > li:nth-of-type(4)").string) print("3", soup.select("#ac-list > li[data-lo='cn']")[0].string) print("4", soup.select("#ac-list > li.alcohol.high")[0].string) param = {"data-lo": "cn", "class": "alcohol"} print("5", soup.find("li", param).string) print("6", soup.find(id="ac-list").find("li",param).string) for ac in soup.find_all("li"): if ac['data-lo'] == 'us': print('data-lo == us', ac.string)
강사님! 강의 잘듣고있습니다. JPA 처음 입문해서 기초적인 질문드립니다. 저는 당연히 account라는 table을 만들고 나서 도메인객체랑 맵핑하는 건줄 알았는데 drop table하고 실행해보니깐 table이 생성되어있네요. 그럼 프로젝트 진행 할때, db에서 테이블을 안만들고 java 도메인 객체 중심으로 테이블 생성하고 진행하나요 ? .. Mybatis만 쓰다가 JPA 처음 써보니깐 신세계이면서도 어떻게 설계를 하지 ? 이 생각부터 듭니다. ㅠㅠ
다른 퀴즈 문제는 해결했는데 discount 문제만 fail이 뜨네요 def discount_price(a): if a<100000: result=0.9 a return result else: result=0.8 a return result a=int(input("가격")) discount_price(a) 사용자한테 가격을 a로 입력받고 함수를 수행하면 가격이 나오도록 했는데 문제에서 뭘 요구하는 건가요..?
js파일 작성하고 스크롤을 내리면 if (document.documentElement.scrollTop > 70) 이 실행될 때, 네비게이션바의 width가 왼쪽으로 줄어들면서 logo와 menu들이 겹쳐서 나타납니다. html, css, js파일 오타까지 다 확인하고 강사님 github에 있는 코드 그대로 복붙해서 실행해도 마찬가지입니다...ㅠ 어디가 문제인지 찾을 수 가 없어요..
안녕하세요! 제가 <ul class="petition_list"> <li style="padding: 20px 0px;"> <div class="bl_wrap"> <span class="sound_only">번호 40305 이렇게 생긴 부분에서 40305를 추출하고 싶은데 select를 이용해서 ul.petition_list까지 간 후에 for문으로 ul.petition_list하위의 모든 부분을 뽑으면 None이 나옵니다ㅠㅠ 자손을 이용해도 도무지 li style부분을 넘어갈 수 없는데 이런 경우는 어떻게 크롤링해야하나요?? 도와주세요ㅠㅠ
안녕하세요 교수님. 실습하다가 의문이 생겨 질문을 드립니다. 제가 C언어 공부할 때, 입력 버퍼는 queue 구조여서 console에서 먼저 입력된 값을 먼저 가져오는 FIFO 형태로 작동하는 것으로 알고 있습니다. 실습에서도 그렇게 작동해서 이해하는데 큰 무리가 없었습니다. 하지만, std::cin.unget() 함수와 std::cin.putback('A') 함수는 예상과 다르게 stack 구조 처럼 작동하네요. 이 경우 마지막 줄에 출력 결과를 x(이전 입력의 마지막 값)ABC 로 예상했지만, 실제로는 CBAx 이렇게 나옵니다. 음... 이경우는 함수가 입력 버퍼 queue의 헤드에 문자를 다시 저장한다고 생각하면 좋을까요?? 제가 생가하는 구조입니다. 키보드 입력 -----> 입력 버퍼(queue) -----> 프로그램 #include <iostream> int main() { char buf[1024]; std::cout << (char)std::cin.peek() << std::endl; std::cin.ignore(1); std::cin >> buf; std::cout << buf << std::endl; std::cin.unget(); std::cin.putback('A'); std::cin.putback('B'); std::cin.putback('C'); std::cin >> buf; std::cout << buf << std::endl; return 0; }
Installing “go-plus@6.1.0” failed.Show output… Compiler tools not found Packages that depend on modules that contain C/C++ code will fail to install. Read here for instructions on installing Python and Visual Studio. Run apm install --check after installing to test compiling a native module. 설치가 안됩니다.
config.json을 git같은 곳에 올리게 되면 username과 password이 노출되게 될 것 같아서 다른 파일로 따로 저장하고자 합니다. json에서도 require()같은 명령이 사용가능한가요..? 아니면 그냥 config.json을 git ignore에 등록해야 할까요?
강의 표에서 signed int 이 부분에서 기울인 글씨는 생략 가능하다고 설명해주셨는데 그러면 지금까지 사용했던 int형 타입이 signed int인건가요?? int형 타입은 4byte로 알고 있었는데 표에서는 signed int는 16비트(2byte)라고 설명되어있어서요.. int와 signed int의 차이점을 설명해주세요!
배포2 단원에서 truffle console --network development 후 truffle(development)> var hello = HelloWorld.at("0x9876ff5b2729D2800f87852F7be329D32B35c244") undefined truffle(development)> hello.say() Thrown: evalmachine.:0 hello.say() ^ TypeError: hello.say is not a function at evalmachine.:0:7 at Script.runInContext (vm.js:135:20) at runScript (C:Users데모버전AppDataRoamingnpmnode_modulestrufflebuildwebpack:packagestruffle-corelibconsole.js:199:1) at Console.interpret (C:Users데모버전AppDataRoamingnpmnode_modulestrufflebuildwebpack:packagestruffle-corelibconsole.js:213:1) at ReplManager.interpret (C:Users데모버전AppDataRoamingnpmnode_modulestrufflebuildwebpack:packagestruffle-corelibrepl.js:118:1) at bound (domain.js:425:14) at REPLServer.runBound [as eval] (domain.js:438:12) at REPLServer.onLine (repl.js:650:10) at REPLServer.emit (events.js:197:13) at REPLServer.EventEmitter.emit (domain.js:481:20) 이렇게 에러가 뜨는데 어떻게 해결해야 하나요?