
from collections import deque
import random
ts=deque(maxlen=6)
while len(ts)!=6:
a=random.randint(1,49)

from collections import deque
import random
ts=deque(maxlen=6)
while len(ts)!=6:
a=random.randint(1,49)

在工作排程器裡,工作的內容,其中動作視窗有三個參數需要設置。
第一個,是python執行檔所在的位置,以上圖為例,為 c:\program files\python35\python.exe
(前後有沒有雙引號是不影響執行結果的)
第二個,是python檔案所在的完整路徑,以上圖為例,為d:\python\helloworld.py
第三個,是python檔案所在的目錄,以上圖為例,為d:\python\
用記事本開啟matplotlibrc 我的路徑如下:C:\Anaconda3\Lib\site-packages\matplotlib\mpl-data\matplotlibrc
將下面三行前面的#取消
font.family : sans-serif
font.serif : DejaVu Serif, Bitstream Vera Serif, ……
#載入pandas模組
import pandas as pd
#欲編輯的excel路徑
filename=r'C:\Users\ylw\.spyder-py3\sorce\stock\test.xlsx'

#說明上圖中k值及d值是透過javascript採非同步傳輸方式,將資料載入至iframe框架中,若直接使用requests.get()的話,是拿不到裡面資料的。
# -*- coding: utf-8 -*-
import time,os
from selenium import webdriver #載入selenium模組
driver=webdriver.PhantomJS(r'c:\phantomjs.exe') #啟動web browser模擬器

wb=openpyxl.load_workbook('test.xlsx')
ws=wb.get_sheet_by_name('test')
#逐欄抓取資料呈現
for col in ws.columns:

方法一:
import openpyxl,os
def showData():
wb=openpyxl.load_workbook('test.xlsx')
ws=wb.get_sheet_by_name('test')

import openpyxl,os
def inputData():
dirpath=os.getcwd()+'/' #取得目前工作路徑
filename='test.xlsx'
fullpath=os.path.join(dirpath,filename)
from win32com import client
import os
docApp=client.Dispatch('Word.Application')
cpath=os.path.dirname(__file__)
doc=docApp.Documents.Open(cpath+r"\doc\text.docx") #與word應用程式連結,並產生word物件
#---------------新增的個空的word 文件-------------------------------
import win32com,os #載入win32,os模組
from win32com.client import *
cpath=os.path.dirname(__file__) #取得目前程式檔所在目錄

from bokeh.plotting import figure,show,output_file
output_file('lineout.html') #輸出成html檔,檔名為lineout.html
p=figure(width=800,height=400,title='零用金統計表') #圖表尺寸大小為800×400
p.title.text_color='green' #圖表標題顏色為綠色,字體大小為18
p.title.text_font_size='18pt'

#查找49樂合彩本期號碼
import requests
from bs4 import BeautifulSoup as bs
url='http://www.taiwanlottery.com.tw/'
html=requests.get(url) #取得樂透彩網站html內容