Python_datetime


Python_datetime

  • date(日期)、time(時間)、datetime(date+time)
  • timedelta(計算立時期間的型態)、timezone(處理時區資訊的型態)
1
import datetime

現在時間

  • datetime.now(datetime.today)
  • date.today()
  • time.localtime()
1
2
3
4
5
import datetime
now = datetime.datetime.now()
print(now)
today = datetime.datetime.today()
print(today)
2021-11-01 12:27:19.926574
2021-11-01 12:27:19.926574
1
2
3
import datetime
only_date = datetime.date.today()
print(only_date)
2021-11-01
1
2
import time
print(time.localtime())
time.struct_time(tm_year=2021, tm_mon=11, tm_mday=1, tm_hour=12, tm_min=30, tm_sec=11, tm_wday=0, tm_yday=305, tm_isdst=0)
閱讀全文

進階電腦操作方法_cmd


進階電腦操作方法_CMD

  1. 關於 Windows 檔案系統
    • 是一個 階層式 的結構
    • 檔案總管(File Explorer)
      • 點選 本機 可以看到目錄和磁碟機
    • 磁碟機 / 根目錄 (Disk/Root Folder)
      • 磁碟機代號 來區隔電腦中的儲存空間
      • C: / D: / E: / F: /
    • 目錄 (Folder) 與檔案 (File)
      • 資料夾 <-> 目錄
      • 路徑( / )
    • 可執行檔(Executable File)
      • .exe
閱讀全文

Tkinter GUI


撰寫GUI設計流程

  1. 建立主視窗(大小、位置、名稱)
  2. 元件(按鈕、文字方塊、選單)加入視窗中
  3. 事件處理函示(event handler):使用者互動時的觸發行為
1
2
#tk.Frame():創建可容納物件的框架
#tk.Frame(window, bg='red', width=100, height=100)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import tkinter as tk

window = tk.Tk()
top_frame = tk.Frame(window)
top_frame.pack()
bottom_frame = tk.Frame(window)
bottom_frame.pack(side = tk.BOTTOM)
def echo_hello():
print('hello word :)')
left_button = tk.Button(top_frame,text = "Red", fg = 'red')
left_button.pack(side = tk.LEFT)

middle_button = tk.Button(top_frame,text = "Green", fg = 'green')
middle_button.pack(side = tk.LEFT)

right_button = tk.Button(top_frame,text = "Blue", fg = 'blue')
right_button.pack(side = tk.LEFT)
bottom_button = tk.Button(bottom_frame,text='Black', fg='black', command = echo_hello)
bottom_button.pack(side = tk.BOTTOM)
window.mainloop()
閱讀全文

Python 網頁爬蟲

開發流程:

  • 分析網站原始碼,取得圖片標籤或屬性
  • 爬取圖片所在網址 (來源網址)
  • 下載圖片到資料夾裡面
閱讀全文

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment