import urllib
import xlrd
from xlwt import Workbook
def getClose(q, i ,p, f):
inputQ=q;
inputI=str(i);
inputP=str(p);
inputF=f;
address='http://www.google.com/finance/getprices?q='+inputQ+'&i='+inputI+'&p='+inputP+'d&f='+inputF;
response = urllib.request.urlopen(address);
data = response.readlines();
newData = data[7:len(data)];
result=[];
amount =0;
for line in newData:
content =str((line.decode("utf-8", errors='ignore').split("\n")[0]));
result.insert(amount,content);
amount = amount +1;
#write the list of result into the excel file
writeBook= Workbook();
writeSheet= writeBook.add_sheet('Close Price');
for n in range(amount):
writeSheet.write(n,0,result[n]);
writeBook.save('close price.xls');
这是我为Alert box ok按钮创建的代码,但我希望多次获取。
答案 0 :(得分:2)
当你点击弹出窗口上的OK按钮然后再次调用(显示)AlertDialog。