0
我想讓腳本在特定時間每天自動運行一次或兩次,那麼最好的方法是什麼。Python使腳本每天在特定時間運行
def get_data():
"""Reads the currency rates from cinkciarz.pl and prints out, stores the pln/usd
rate in a variable myRate"""
sock = urllib.urlopen("https://cinkciarz.pl/kantor/kursy-walut-cinkciarz-pl/usd")
htmlSource = sock.read()
sock.close()
currancyRate = re.findall(r'<td class="cur_down">(.*?)</td>',str(htmlSource))
for eachTd in currancyRate:
print(eachTd)
print currancyRate[0]
myRate = currancyRate[0]
print myRate
return myRate
我想代碼本身內做到這一點,但是這是一個想法 –
那麼你可能要像這樣http://stackoverflow.com/a/16786600/1517864 – jayant