,장고
try:
print "what"
newClassName = CourseNameAndCodeAssociation.objects.get(departmentCode__iexact = nameAndNumberStore[0])
print newClassName
except:
print "HAHA"
작동하지 않음 제외보십시오이 항상 인쇄 "하하"나는 콘솔에서 newClassName = ... 코드를 실행했는데이 일을 있다는 사실에도 불구하고.
왜 이런 일이 발생합니까?
편집
def newGetAllInformation(searchTerm):
nameAndNumberStore = modifySearchTerm(searchTerm)
urlStore = modifyUrl(nameAndNumberStore) # need to make the change here -- why not I go to the site, check for Course name - if that is not there switch, if it is then scrape
soup = getHtml(urlStore)
storeOfBooks = []
storeOfBooks = scrape(soup,nameAndNumberStore)
print nameAndNumberStore[0]
try:
newClassName = CourseNameAndCodeAssociation.objects.get(departmentCode__iexact = nameAndNumberStore[0])
nameAndNumberStore = modifySearchTerm(newClassName.departmentName + " " + nameAndNumberStore[1])
urlStore = modifyUrl(nameAndNumberStore)
soup = getHtml(urlStore)
storeOfBooks = scrape(soup,nameAndNumberStore)
except:
print "HAHA"
return storeOfBooks
편집 추가 조사 후 - 즉, 수동 (이 근무), 내가 뭔가 업에도 불구하고 array-의 코드를 복용가 있다고 생각 유효한 코드를 입력 둘 다 동일한 데이터 유형 (문자열)이라는 사실. nameAndNumberStore[0]
이 경제학
시도해 보셨습니까? 예외 처리를 하시겠습니까? –
코드 스 니펫에 가져 오기가 없습니다. 어쩌면 전체 콘솔 세션과 환경에 영향을 미치는 모든 코드를 보여 주면 도움이 될 것입니다. – Marcin
어, BeautifulSoup, re, urllib2 및 cookielib을 가져옵니다. 전체적으로이 함수에 의해 호출되는 함수가 많이 있지만 전체를 게시합니다. 예외를 통해 무엇을 의미합니까? 나는 프로그래밍에 익숙하지 않은가? 잡을 필요가 없는가? – praks5432