0
이것은 나를 괴롭 히고 있습니다. 이 코드를 사용하는 경우 :Python imaplib : .search를 사용하여 메시지를 찾을 수 없습니다. 검색을 하드 코드하면 작동합니다.
while msgnums == ['']: # wait until message list from server isn't empty
typ, msgnums = gmail.m.uid('search', None, 'To', new_user)
print '\n', new_user, sec_waiting, typ, msgnums
출력은 다음과 같습니다 즉
[email protected] 300 OK ['']
이 내 메시지를 찾는 아니에요. 하지만,이 같은 내가 하드 코딩을하는 경우 :
typ, msgnums = gmail.m.uid('search', None, 'To', '[email protected]')
출력은 다음과 같습니다
[email protected] 0 OK ['19']
은 (그것은 메시지를 찾습니다.) NEW_USER는 문자열입니다. 왜 작동하지 않는지 나는 이해할 수 없다.
search_string = '(To \"' + created_username + '\")'
while msg_uid == ['']: # wait until message list from server isn't empty
resp, msg_uid = gmail.m.search(None, search_string)
을하지만 너무 실패
는 I도 노력했다.
위는 구문 에러를 생산, 뭔가는 gmail.m.search 통화에서 따옴표에 문제가 있습니다. – themel
'new_user'가 변수라고 가정하면, 그것은 따옴표가되어서는 안됩니다. 두 번째 줄에 'typ, msgnums = gmail.m.search (None,'TO ', new_user)'라고 읽어야합니다. – brc
new_user로 시도했지만 아직 메시지를 찾지 못했습니다. 나는 또한 themel의 의견 당 따옴표를 정정하고 아직도 실패한다. –