코드 일부분: url = " https://api.github.com/repositories " savename = "c:/section4/repo.json" if not os.path.exists(url): req.urlretrieve(url, savename) 질문: if not os.path.exists(url): // 이 부분에서 url이 아니라 savename이 들어가야하는 거 아닌가요 ??? 경로에 위치하고 있는 파일 이름이 존재하지 않으면 파일을 만들어 저장하는 거 아닌가요???
Fatal: Error starting protocol stack: listen tcp 127.0.0.1:8545: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted. 이렇게 떠서 진행이 안돼요 ㅜㅜ
안녕하세요. 신규 가입자입니다. 신규 가입 절차상에서 느꼈던 불편했던 점을 공유하고 답변 받고자 합니다. 페이스북으로 가입시 오류 발생 An error occurred while creating a new user! 라는 오류가 발생하며 가입이 되지 않습니다. 활성화 키를 찾을 수 없음 가입후 가입완료 메일의 링크를 클릭하면 나타나는 페이지에서 활성화를 위한 키를 입력하라고 하는데 어디에서도 활성화를 위한 키를 찾을 수 없습니다. 무시하고 페이지를 닫고 로그인을 하니 정상적으로 로그인이 되지만 사용자에게 불편함을 줍니다.
https://www.dropbox.com/s/jl8s21vmq7o3xqi/%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202018-07-24%20%EC%98%A4%EC%A0%84%202.46.32.png?dl=0 지금 하나씩 과제 제출한거 결과 다시 보고 있는데.. . 이것도 그렇고 다른데도 질문을 올렸는데.. 터미널 창에선 분명 pass라고 뜨는데 왜 인프런 결과 확인만 하면 하나씩 비는지 모르겠어요..' 깔끔하게 끝내고 넘어가고 싶은데 굉장히 답답
main() 함수에서 결과 값에 잘못된 게 없는 듯 한데 왜 fail이 계속 뜨는지 이유를 모르겠습니다. 메인 함수를 아래와 같이 첨부합니다. def main(): user_input = 999 # ===Modify codes below============= while(user_input != 0): user_input = input("Input a positive number : ") if is_positive_number(user_input) is True: user_input = int(user_input) result = get_factorial_value(user_input) print(result) # print("Thank you for using this program") return result elif is_positive_number(user_input) is False and user_input is "0": # print("Thank you for using this program") user_input=0 return user_input else: print("Input again, Please") print("Thank you for using this program") # ==================================
Node find_item(char item) { Node *temp = head; while (temp!=NULL) { if (strcmp(temp->data, item) == 0) { return temp; } else { temp = temp->next; } } } 이렇게 쓰고 메인 함수에 Node head = (Node )malloc(sizeof(Node)); head->data = "monday"; head->next = head; Node *tem=find_item("monday"); printf("%s", tem->data); 이런 식으로써넣었는데 아무것도 안나오더라구요 왜그럴까요 그리고 왜 함수들을 void형식이 아닌 Node 형식으로 만드나요?
방금 질문을 올린것 같은데 제대로 안올려져서 다시 한번 올립니다. (중복이면 죄송합니다.ㅠㅠㅠ) 강의보고 따라하고 있는데 abstractapplicationcontext 부분에서 오류가 뜨네요. GenericXmlApplicationContext cannot be resolved to a type The constructor GenericApplicationContext(String) is undefined AbstractApplicationContext cannot be resolved to a type 이렇게 뜨는데 혹시 어떻게 해야 해결할수 있을지 알 수 있을까요?? 참고로 저 AbstractApplicationContext 부분이 제 컴퓨터에 안깔려있는지 연동이 안되는지 반응도 없습니다.ㅠㅠㅠ
from bs4 import BeautifulSoup import urllib.request as req import urllib.parse as rep import sys import io import os sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8') sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8') base = " https://search.naver.com/search.naver?where=image&query =" quote = rep.quote_plus("사자") url = base + quote res = req.urlopen(url) savePath ="C:imagedown\" try: if not(os.path.isdir(savePath)): os.makedirs(os.path.join(savePath)) except OSError as e: if e.errno != errno.EEXIST: print("폴더 만들기 실패!!!!!") raise soup = BeautifulSoup(res, "html.parser") li_list = soup.select("div.img_area._item > a.thumb._thumb > img") for i, div in enumerate(li_list,1): print("div =", div['data-source']) fullfilename = os.path.join(savePath, savePath+str(i)+'.jpg') print(fullfilename) req.urlretrieve(div['data-source'],fullfilename) print(i) 실행이 안됩니다. 4일째 구글링하면서 방법을 찾고 있지만 더 이상 찾을수가 없어 질문드립니다. res = req.urlopen(url) 이 부분에서 에러가 납니다. urlopen이 안되는 것 같은데. 이미 컴퓨터 포맷도 해보고 다시 재설치까지 해봤습니다. 더이상 방법을 알지 못해 글남깁니다. 아래는 오류 코드입니다. Traceback (most recent call last): File "C:section22-8-1.py", line 16, in res = req.urlopen(url) File "C:UsersM.KingAnaconda3envssection2liburllibrequest.py", line 163, in urlopen return opener.open(url, data, timeout) File "C:UsersM.KingAnaconda3envssection2liburllibrequest.py", line 472, in open response = meth(req, response) File "C:UsersM.KingAnaconda3envssection2liburllibrequest.py", line 582, in http_response 'http', request, response, code, msg, hdrs) File "C:UsersM.KingAnaconda3envssection2liburllibrequest.py", line 510, in error return self._call_chain( args) File "C:UsersM.KingAnaconda3envssection2liburllibrequest.py", line 444, in _call_chain result = func(args) File "C:UsersM.KingAnaconda3envssection2liburllibrequest.py", line 590, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden [Finished in 0.474s]
기존에 Python 3.6을 쓰고 있어서 버전을 변경하려는데 3.1로 바꾸면 OK버튼이 안눌리게끔 나오고 밑에 environment location directory is not empty라고 뜹니다. 그래서 빈 폴더를 만들어서 OK버튼을 누르면 http_error_msg = u’%s Client Error: %s for url: %s’ % (self.status_code, reason, self.url) 이라는 에러가 뜹니다. 어떻게 해결해야 할까요? 추가로 삭제하고 다시 깔아보기도 했는데 python 3.3 이상의 버전을 써야한다고 에러가 뜹니다. 강의에서 3.1을 쓰지않으면 많이 헤맬거라고 해서 어떻게 해야할까요?