2020-09-22から1日間の記事一覧

* 「Pythonのpprintの使い方(リストや辞書を整形して出力)」というページ

:CATEGORIES: python pprintの基本的な使い方 出力幅(文字数)を指定: 引数width 出力する要素の深さを指定: 引数depth インデント幅を指定: 引数indent 改行を最小限にする: 引数compact 文字列に変換: pprint.pformat() 例: 二次元配列(リストのリ…

* pythonのenumerate関数の開始数値の指定と,format関数での数値のゼロ埋め

:CATEGORIES: python for i, name in enumerate(l, 1): print('{:03}_{}'.format(i, name)) # 001_Alice # 002_Bob # 003_Charlie[source:]Python, enumerateの使い方: リストの要素とインデックスを取得 | note.nkmk.me https://note.nkmk.me/python-…

* pythonの「pandasでExcelファイル(xlsx, xls)の書き込み(to_excel)」

:CATEGORIES: pythonpandasでExcelファイル(xlsx, xls)の書き込み(to_excel) | note.nkmk.me https://note.nkmk.me/python-pandas-to-excel/ 上記のページを参考に次の2つのパッケージをpipでインストールしたところすぐに使えました。pip install xlwt …