- program define mycode
- di "I am going to print a random number get from random.org"
- python:
- import urllib.request
- import re
- api = "https://www.random.org/integers/?num=1&min=1&max=100&col=1&base=10&format=plain&rnd=new&cl=w"
- response = urllib.request.urlopen(api)
- response_text = response.read().decode('utf-8')
- try:
- match = re.search(r"font-weight:bold;'>(.*?)\n</span>", response_text)
- print(match.group(1))
- except Exception as e:
- print('获取出错:', e)
- end
- end


雷达卡




京公网安备 11010802022788号







