Grove,Python,RaspberryPi

Thumbnail of post image 014

Groveとは?
用意したもの
GrovePi+シールドをRaspberry Piに取り付ける
GrovePiのソースコードをダウンロード&インストール
GrovePi+シールドにLEDモジュールを取り付ける ...

Python

Thumbnail of post image 193

# 必要なモジュールのインポートimport BeautifulSoupimport retry:# Python 3from urllib import requestexcept ImportError:# Python 2import ...

Python

Thumbnail of post image 189

なんでこんなことするの?

CNNで学習するために、画像ファイルをTrainingとValidationに分けたかったから。

画像ファイルを7:3に分けるスクリプトfrom glob import globfrom os.path ...

Python

Thumbnail of post image 147

In: from PIL import ImageIn: img_pil = Image.open("hoge.png")In: img_pil.mode Out: 'RGBA'In: img_pil = img_pil.convert(" ...

Python

Thumbnail of post image 161

Beautiful soupでパースしたオブジェクトにfind_allの後にfind_allをするとエラーが出る.# エラーがでる例soup = BeautifulSoup(html, "html.parser")obj = soup.fi ...

Python

Thumbnail of post image 152

Anaconda Prompt上で以下のコマンドを打つだけでOK

(標準のCommand PromptやWindows Power Shellではない)

anaconda-navigator --reset

Python

Thumbnail of post image 104

ノードの引数に貼り付けたい画像のバスを書くだけ。

from graphviz import Digraph# Ready to parent graph.g = Digraph(comment = 'Graph')g.node( ...

Docker,Python

Thumbnail of post image 171

Pythonの実行環境を構築したDockerコンテナに入ってコマンド実行

$ docker exec hoge-container python hoge.py arg1 arg2

hoge-container: Pytho ...

Python

Thumbnail of post image 017

# configファイルの作成$ jupyter notebook --generate-config# geditでconfigファイルを開き、c.NotebookApp.notebook_dirの変数に好きな場所に書き換える$ gedi ...

Python

Thumbnail of post image 053

やりたいこと:
$\beta$($circ$C) を (C) にしたい

正規表現:
\$.+?\$

詳細:

\$: $をエスケープ

+: 1回以上の繰り返し

...