PythonDevelop
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#contents()
*** マニュアル ・ 教材関係 [#q1d4541f]
- [[Python 3.7.3 ドキュメント (公式マニュアル):https://do...
- [[Python Boot Camp Text:https://pycamp.pycon.jp/]]
*** .bashrc の設定(Ubuntu 18.04 のデフォルトを python3 ...
alias python='python3'
alias pip='pip3'がある
*** .vimrc の設定 (python ファイルに対してだけ有効な設定...
autocmd FileType python setl autoindent
autocmd FileType python setl smartindent cinwords=if,eli...
autocmd FileType python setl tabstop=8 expandtab shiftwi...
*** 関数の場所、main() 関数の意味 [#ba83ba57]
- Pythonは上から下にプログラム文を解釈するので &color(red...
- &color(red){実行部分のコードをmain()関数で括る}; ことで...
- 先頭でmain()関数を定義した場合でも &color(red){main()関...
- [[Pythonスクリプトの書き方(4パターン):https://gammas...
*** 関数の引数(args, kwargs) [#n74096ab]
関数定義で引数に*と**(1個または2個のアスタリスク)をつけ...
- *args: 複数の引数をタプルとして受け取る
- **kwargs: 複数のキーワード引数を辞書として受け取る (kw ...
-- キーワード引数 : 引数名=値 で指定する
- [[詳細説明:https://note.nkmk.me/python-args-kwargs-usag...
*** ファイル読み込み(コマンドライン引数でファイル名を指...
import sys
script_name = sys.argv[0]
try:
file_name = sys.argv[1]
file_desc = open(file_name, 'r')
except IndexError:
print 'Usage: %s TEXTFILE' % script_name
except IOError:
print '"%s" cannot be opened.' % file_name
else:
# ファイルを一行ずつ読み込む場合
for line in file_desc:
print line
# ファイル全体をまとめてリストに読み込む場合
lines = file_desc.readlines()
print lines
file_desc.close()
*** 数字の整形(桁区切り、小数点の丸め) [#z0157cf8]
>>> "{:,}".format(1234.5678)
'1,234.5678'
>>> "{:,.2f}".format(1234.5678)
'1,234.57'
logging.debug("size = %s byte", "{:,}".format(vfp_size))
*** print の自動改行を無効化 [#l87282c8]
- print("abc","") のように空白文字を行末に付与する
*** 文字列を指定したセパレータで分解する [#r2bcea4c]
- split("セパレータ文字") で要素に分解されてリストに格納...
- split("セパレータ",N) で N 番目まで区切って、以下は分解...
*** python で正規表現を使う方法 [#i15d2659]
import re
- re モジュールには正規表現パターンを使用した検索、置換、...
- これらのメソッドはマッチした文字列を返すものもあれば、M...
|group()|マッチした文字列を返す|
|start()|マッチした文字列の開始位置を返す|
|end()|マッチした文字列の終了位置を返す|
|span()|マッチした文字列の (開始位置, 終了位置) のタプル...
- [[python 正規表現 HOWTO:https://docs.python.org/ja/3/ho...
*** [[Python 日付、時刻の処理 (外部モジュール dateutil):h...
- インストール
munakata@muna-E450:~/code/python/$ pip3 install python-d...
*** SQLite [#q40bf7c8]
- [[python3でsqlite3の操作。作成や読み出しなどの基礎:http...
- SQLiteのデータ型は5種類しかない
-- NULL,
-- INTEGER(整数),
-- REAL(浮動小数点),
-- TEXT(文字列),
-- BLOB(バイナリ)
- ヘッダー表示
-- .headers ON
- 表示形式 = .mode
-- .mode line
-- .mode list
-- .mode column
*** Open CV [#w30f7baa]
- install (sudo をつけて実行するとエラーになる)
munakata@muna-E450:~/code/python/vlman2019$ pip3 install...
- それでも module not found になる場合、OpenCV は特定のバ...
*** pylint 関連 [#e6878135]
- ~/.config に pylintrc を作成
[local] munakata:~/source/python/vlman$ pylint --generat...
- 警告の最後の()内を~/.config/pylintrcのdisabledに追加す...
-- &ref(pylintrc);
- 正攻法の解決方法例は [[Python(Pylint)の警告を解決する:h...
*** 仮想環境の構築 [#p31eb801]
- python では開発アプリ毎に python や関連ソフトウエアのバ...
- とはいえ、個人で一つのアプリを作るだけなら仮想環境は不...
- コマンド(Ubuntu 18.04)
-- パッケージ名 : python3-venv
-- 仮想環境の構築 : python -m env (仮想環境名)
-- 仮想環境の起動 : (仮想環境ディレクトリー)&color(red...
-- 仮想環境の終了 : deactivate
-- 仮想環境の削除 : rm (仮想環境名)
munakata@muna-E450:~/code/python$ sudo apt install pytho...
munakata@muna-E450:~/code/python$ python -m venv vman <...
munakata@muna-E450:~/code/python$ cd vman
munakata@muna-E450:~/code/python/vman$ ls -l <---------...
合計 20
drwxr-xr-x 2 munakata munakata 4096 6月 25 17:51 bin
drwxr-xr-x 2 munakata munakata 4096 6月 25 17:51 include
drwxr-xr-x 3 munakata munakata 4096 6月 25 17:51 lib
lrwxrwxrwx 1 munakata munakata 3 6月 25 17:51 lib64 ...
-rw-r--r-- 1 munakata munakata 69 6月 25 17:51 pyvenv...
drwxr-xr-x 3 munakata munakata 4096 6月 25 17:51 share
munakata@muna-E450:~/code/python/vman$ source bin/activa...
(vman) munakata@muna-E450:~/code/python/vman$ <---------...
(vman) munakata@muna-E450:~/code/python/vman$ deactivate...
munakata@muna-E450:~/code/python/vman$ <----------- プ...
*** [[PyAV:https://docs.mikeboers.com/pyav/develop/index....
- [[installation:https://docs.mikeboers.com/pyav/develop/...
*** [[python-pptx:https://python-pptx.readthedocs.io/en/l...
- [[Documentatrion (user guide):https://python-pptx.readt...
-- [[Concepts (オブジェクトの構成、テンプレートの読み込み...
-- [[Working with Slides (スライドの構造、スライドの追加)...
-- [[Understanding placeholders (既存テンプレートのプレー...
- スライドアスペクト指定
-- # set slide aspect = 16:9
-- prs.slide_width = 9144000
-- prs.slide_height = 5143500
//-- 16:9 標準設定 は 33,867cm x 19,05cm => 12,192,120 EM...
//-- https://gist.github.com/glass5er/748cda36befe17fd1cb0
- スライドレイアウトの指定(スライドマスターのどの表示形...
-- prs.slide_layouts[0] = Title (presentation title slide)
-- prs.slide_layouts[1] = Title and Content
-- prs.slide_layouts[2] = Section Header (sometimes calle...
-- prs.slide_layouts[3] = Two Content (side by side bulle...
-- prs.slide_layouts[4] = Comparison (same but additional...
-- prs.slide_layouts[5] = Title Only
-- prs.slide_layouts[6] = Blank
-- prs.slide_layouts[7] = Content with Caption
-- prs.slide_layouts[8] = Picture with Caption
- &ref(python-pptx — python-pptx 0.6.18 documentation.mht...
*** [[2次元リストの任意の要素でソートする:https://note.nk...
- デフォルトでは最初の要素でソートされる
- ソートキーを指定するには python の lambda(無名関数)を...
sort_2d_table.sort(key=lambda, x: x[1]) <--- 2つめの要...
- 参考 URL
-- [[python-pptxまとめ:https://qiita.com/pocket8137/items...
-- [[Pythonでパワポの説明資料(報告書)を生成する:https:/...
-- [[pythonで作ったパワーポイントで自己紹介してみた:https...
-- [[[Python]爆速で報告パワポを生成する!:https://qiita.c...
*** [[Progate:https://prog-8.com/languages]] [#v37c3304]
- account = Google account
- 2019/07/04 で有償会員を退会
*** [[paiza:https://paiza.jp/works/mypage]] [#lbdf6a1f]
- account = magu775@gmail.com
- pass = frex7785
*** 参考 URL [#ib6cbc95]
-- [[35歳+営業職+プログラミング経験なしのPython学習方法...
-- [[初学者・初級者向け Django の学習ロードマップ:https:/...
終了行:
#contents()
*** マニュアル ・ 教材関係 [#q1d4541f]
- [[Python 3.7.3 ドキュメント (公式マニュアル):https://do...
- [[Python Boot Camp Text:https://pycamp.pycon.jp/]]
*** .bashrc の設定(Ubuntu 18.04 のデフォルトを python3 ...
alias python='python3'
alias pip='pip3'がある
*** .vimrc の設定 (python ファイルに対してだけ有効な設定...
autocmd FileType python setl autoindent
autocmd FileType python setl smartindent cinwords=if,eli...
autocmd FileType python setl tabstop=8 expandtab shiftwi...
*** 関数の場所、main() 関数の意味 [#ba83ba57]
- Pythonは上から下にプログラム文を解釈するので &color(red...
- &color(red){実行部分のコードをmain()関数で括る}; ことで...
- 先頭でmain()関数を定義した場合でも &color(red){main()関...
- [[Pythonスクリプトの書き方(4パターン):https://gammas...
*** 関数の引数(args, kwargs) [#n74096ab]
関数定義で引数に*と**(1個または2個のアスタリスク)をつけ...
- *args: 複数の引数をタプルとして受け取る
- **kwargs: 複数のキーワード引数を辞書として受け取る (kw ...
-- キーワード引数 : 引数名=値 で指定する
- [[詳細説明:https://note.nkmk.me/python-args-kwargs-usag...
*** ファイル読み込み(コマンドライン引数でファイル名を指...
import sys
script_name = sys.argv[0]
try:
file_name = sys.argv[1]
file_desc = open(file_name, 'r')
except IndexError:
print 'Usage: %s TEXTFILE' % script_name
except IOError:
print '"%s" cannot be opened.' % file_name
else:
# ファイルを一行ずつ読み込む場合
for line in file_desc:
print line
# ファイル全体をまとめてリストに読み込む場合
lines = file_desc.readlines()
print lines
file_desc.close()
*** 数字の整形(桁区切り、小数点の丸め) [#z0157cf8]
>>> "{:,}".format(1234.5678)
'1,234.5678'
>>> "{:,.2f}".format(1234.5678)
'1,234.57'
logging.debug("size = %s byte", "{:,}".format(vfp_size))
*** print の自動改行を無効化 [#l87282c8]
- print("abc","") のように空白文字を行末に付与する
*** 文字列を指定したセパレータで分解する [#r2bcea4c]
- split("セパレータ文字") で要素に分解されてリストに格納...
- split("セパレータ",N) で N 番目まで区切って、以下は分解...
*** python で正規表現を使う方法 [#i15d2659]
import re
- re モジュールには正規表現パターンを使用した検索、置換、...
- これらのメソッドはマッチした文字列を返すものもあれば、M...
|group()|マッチした文字列を返す|
|start()|マッチした文字列の開始位置を返す|
|end()|マッチした文字列の終了位置を返す|
|span()|マッチした文字列の (開始位置, 終了位置) のタプル...
- [[python 正規表現 HOWTO:https://docs.python.org/ja/3/ho...
*** [[Python 日付、時刻の処理 (外部モジュール dateutil):h...
- インストール
munakata@muna-E450:~/code/python/$ pip3 install python-d...
*** SQLite [#q40bf7c8]
- [[python3でsqlite3の操作。作成や読み出しなどの基礎:http...
- SQLiteのデータ型は5種類しかない
-- NULL,
-- INTEGER(整数),
-- REAL(浮動小数点),
-- TEXT(文字列),
-- BLOB(バイナリ)
- ヘッダー表示
-- .headers ON
- 表示形式 = .mode
-- .mode line
-- .mode list
-- .mode column
*** Open CV [#w30f7baa]
- install (sudo をつけて実行するとエラーになる)
munakata@muna-E450:~/code/python/vlman2019$ pip3 install...
- それでも module not found になる場合、OpenCV は特定のバ...
*** pylint 関連 [#e6878135]
- ~/.config に pylintrc を作成
[local] munakata:~/source/python/vlman$ pylint --generat...
- 警告の最後の()内を~/.config/pylintrcのdisabledに追加す...
-- &ref(pylintrc);
- 正攻法の解決方法例は [[Python(Pylint)の警告を解決する:h...
*** 仮想環境の構築 [#p31eb801]
- python では開発アプリ毎に python や関連ソフトウエアのバ...
- とはいえ、個人で一つのアプリを作るだけなら仮想環境は不...
- コマンド(Ubuntu 18.04)
-- パッケージ名 : python3-venv
-- 仮想環境の構築 : python -m env (仮想環境名)
-- 仮想環境の起動 : (仮想環境ディレクトリー)&color(red...
-- 仮想環境の終了 : deactivate
-- 仮想環境の削除 : rm (仮想環境名)
munakata@muna-E450:~/code/python$ sudo apt install pytho...
munakata@muna-E450:~/code/python$ python -m venv vman <...
munakata@muna-E450:~/code/python$ cd vman
munakata@muna-E450:~/code/python/vman$ ls -l <---------...
合計 20
drwxr-xr-x 2 munakata munakata 4096 6月 25 17:51 bin
drwxr-xr-x 2 munakata munakata 4096 6月 25 17:51 include
drwxr-xr-x 3 munakata munakata 4096 6月 25 17:51 lib
lrwxrwxrwx 1 munakata munakata 3 6月 25 17:51 lib64 ...
-rw-r--r-- 1 munakata munakata 69 6月 25 17:51 pyvenv...
drwxr-xr-x 3 munakata munakata 4096 6月 25 17:51 share
munakata@muna-E450:~/code/python/vman$ source bin/activa...
(vman) munakata@muna-E450:~/code/python/vman$ <---------...
(vman) munakata@muna-E450:~/code/python/vman$ deactivate...
munakata@muna-E450:~/code/python/vman$ <----------- プ...
*** [[PyAV:https://docs.mikeboers.com/pyav/develop/index....
- [[installation:https://docs.mikeboers.com/pyav/develop/...
*** [[python-pptx:https://python-pptx.readthedocs.io/en/l...
- [[Documentatrion (user guide):https://python-pptx.readt...
-- [[Concepts (オブジェクトの構成、テンプレートの読み込み...
-- [[Working with Slides (スライドの構造、スライドの追加)...
-- [[Understanding placeholders (既存テンプレートのプレー...
- スライドアスペクト指定
-- # set slide aspect = 16:9
-- prs.slide_width = 9144000
-- prs.slide_height = 5143500
//-- 16:9 標準設定 は 33,867cm x 19,05cm => 12,192,120 EM...
//-- https://gist.github.com/glass5er/748cda36befe17fd1cb0
- スライドレイアウトの指定(スライドマスターのどの表示形...
-- prs.slide_layouts[0] = Title (presentation title slide)
-- prs.slide_layouts[1] = Title and Content
-- prs.slide_layouts[2] = Section Header (sometimes calle...
-- prs.slide_layouts[3] = Two Content (side by side bulle...
-- prs.slide_layouts[4] = Comparison (same but additional...
-- prs.slide_layouts[5] = Title Only
-- prs.slide_layouts[6] = Blank
-- prs.slide_layouts[7] = Content with Caption
-- prs.slide_layouts[8] = Picture with Caption
- &ref(python-pptx — python-pptx 0.6.18 documentation.mht...
*** [[2次元リストの任意の要素でソートする:https://note.nk...
- デフォルトでは最初の要素でソートされる
- ソートキーを指定するには python の lambda(無名関数)を...
sort_2d_table.sort(key=lambda, x: x[1]) <--- 2つめの要...
- 参考 URL
-- [[python-pptxまとめ:https://qiita.com/pocket8137/items...
-- [[Pythonでパワポの説明資料(報告書)を生成する:https:/...
-- [[pythonで作ったパワーポイントで自己紹介してみた:https...
-- [[[Python]爆速で報告パワポを生成する!:https://qiita.c...
*** [[Progate:https://prog-8.com/languages]] [#v37c3304]
- account = Google account
- 2019/07/04 で有償会員を退会
*** [[paiza:https://paiza.jp/works/mypage]] [#lbdf6a1f]
- account = magu775@gmail.com
- pass = frex7785
*** 参考 URL [#ib6cbc95]
-- [[35歳+営業職+プログラミング経験なしのPython学習方法...
-- [[初学者・初級者向け Django の学習ロードマップ:https:/...
ページ名: