Task list of What
- Pick the flowers
- Call John 9303032332
- Cancel cable subscription
- Book the flight tickets
| #!/usr/bin/env python | |
| # -*- coding: UTF-8 -*- | |
| # FILE: "/home/joze/colors.py" | |
| # LAST MODIFICATION: "Di, 21 Mär 2006 17:02:41 CET (joze)" | |
| # Copyright (C) 2006 by Johannes Zellner, <[EMAIL PROTECTED]> | |
| # $Id:$ | |
| import sys | |
| import os |
| #!/usr/bin/env python | |
| # | |
| # Copyright (C) 2012 Vinay Sajip. Licensed under the MIT license. | |
| # | |
| # Based on Roberto Alsina's 128-line web browser, see | |
| # | |
| # http://lateral.netmanagers.com.ar/weblog/posts/BB948.html | |
| # | |
| import json | |
| import os |
| # Hacky script for downloading videos from PyVideo and converting them to m4v | |
| # format so they can be synced onto your apple device. Useful if you | |
| # want to see everything that happened at PyCon while commuting. | |
| # | |
| # Requirements: | |
| # * pip install requests BeautifulSoup | |
| # * youtube-dl (from https://github.com/rg3/youtube-dl/) - add this to the | |
| # directory where this script runs and ensure its execute bit is set. | |
| # This was the only YouTube downloader I found that worked. It doesn't | |
| # really have a good Python API so I call it through os.system. |
Task list of What
看了這篇手癢,也來寫寫看。 順便練習python的物件導向。(因為我很少用) 目標,將一個字串轉換成 Hans 物件,利用 hans 屬性存取,將字串中的數字轉成正楷國字,並保有 str 的方法。
# Hans物件,繼承str,並初始化。
class Hans(str):
def __init__(self, string=""):| #encoding=utf-8 | |
| import jieba | |
| sentence = "鼓,可以傳遞訊息、也是一種節奏樂器,在台灣無論是神將團、八家將、官將首、布袋戲這些傳統藝陣技藝項目,還是紅白喜事民俗活動,鼓聲都是不可或缺的重要元素,今天咱們要 | |
| 跟著祖傳三代的製鼓世家來「講鼓」,講「鼓」早的故事、製鼓的辛苦,聽鼓聲傳千里,振作精神勇往直前!" | |
| print("Input:", sentence) | |
| words = jieba.cut(sentence, cut_all=False) | |
| print("Output 精確模式 Full Mode:") | |
| for word in words: | |
| print(word) |
| # https://stackoverflow.com/questions/59231945/how-to-set-histogram-color-as-a-gradient | |
| def pretty_hist(data, bins, n_loops=8, alpha=1, base_color=[0.121569, 0.466667, 0.705882]): | |
| N, bins, patches = plt.hist(data, bins=bins, density=True) | |
| bm = bins.max() | |
| bins_norm = bins / bm | |
| bc = base_color | |
| for bin_norm, patch in zip(bins_norm, patches): | |
| grad = np.sin(np.pi * n_loops * bin_norm) / 15 + .04 |