Python

Thumbnail of post image 110

In : from nltk.corpus import stopwordsIn : stopWords = stopwords.words('english')In : stopWordsOut: In: len(stopWords)Ou ...

Grove,Python,RaspberryPi

Thumbnail of post image 051

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

Python

Thumbnail of post image 054

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

Python

Thumbnail of post image 117

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

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

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

Python

Thumbnail of post image 082

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 176

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

Python

Thumbnail of post image 173

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

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

anaconda-navigator --reset

Python

Thumbnail of post image 047

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

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

Docker,Python

Thumbnail of post image 162

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

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

hoge-container: Pytho ...

Python

Thumbnail of post image 013

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