크롬 웹스토어 바로가기
https://github.com/kkuzil/ChrExLottoHelper
아래는 기본적으로 제공하는 구매번호 정보입니다.

아래처럼 "당첨번호" 와 일치번호 하이라이트 기능을 제공합니다.

kkuzil.own@gmail.com
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import requests
URL_GetLottoNumber = "https://www.dhlottery.co.kr/common.do?method=getLottoNumber&drwNo="
def LottoDataAllToFile(sPath, bClear = False):
if (bClear == False) and os.path.exists(sPath):
fData = open(sPath, mode="r+t", encoding="utf-8")
LdList = fData.readlines()
i = len(LdList)
print("로또 데이터 이어서 저장 (최근 %d회차)" % i)
i += 1
else:
fData = open(sPath, mode="wt", encoding="utf-8")
i = 1
print("로또 데이터 초기화")
try:
nAddCnt = 0
while True:
try:
resp = requests.get(URL_GetLottoNumber + str(i))
jsResult = resp.json()
if jsResult["returnValue"] != "success":
break
fData.write(str(jsResult) + "\n")
nAddCnt += 1
except Exception as E:
print(str(E))
break
print("%d회차 추가완료.." % (i))
i += 1
if nAddCnt > 0:
print("로또 데이터 가져오기 끝 (새로 가져온 회차 수 : %d, 마지막 회차 : %d)" % (nAddCnt, i - 1))
else:
print("새로운 회차 데이터 없음")
finally:
fData.close
# 함수 실행
LottoDataAllToFile("LottoData.dat")
|
cs |
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import requests
URL_GetLottoNumber = "https://www.dhlottery.co.kr/common.do?method=getLottoNumber&drwNo=" # 현재 동행로또 주소
sDrwNum = input("당첨번호를 확인할 회차 번호를 입력해주세요 : ")
resp = requests.get(URL_GetLottoNumber + sDrwNum)
jsResult = resp.json()
if jsResult["returnValue"] == "success":
print(jsResult)
else:
print("존재하지 않는 회차 번호입니다. (입력됨 : %s)" % (sDrwNum))
|
cs |