Tag Archives: Module

Python: テキストファイルの行頭に行番号を追加

コマンドラインで指定されたテキストファイルの行頭に行番号を追加し、そのデータを新たなファイルに書き出すスクリプトです。 ソースコード #!/usr/bin/python # coding: UTF-8 import sy … Continue reading

Posted in Python | Tagged , , , , , | 3 Comments

Python: コマンドライン引数の取得 – sys.argv変数

コマンドラインで与える引数によってプログラムの挙動を変えたいという場面はよくあります。Python ではコマンドライン引数は sys モジュールの argv 属性に文字列を要素とするリストとして格納されています。そして、 … Continue reading

Posted in Python | Tagged , , , , | 1 Comment

Python: SQLiteにデータを格納、検索、出力 – pysqlite

レコードの検索や格納処理性能がオープンソースのDBで間に合う程度の問題であれば、積極的に使っていきたいです。それによって、他のロジックのコーディングに傾注できます。また、DBという共通のプラットフォームは複数言語から扱え … Continue reading

Posted in Python | Tagged , , | Leave a comment

Magic Workstation にインポートするオリジナルカードの作成スクリプト

Magic Workstation(MWS)という対戦カードゲームMagic: The Gatheringが出来るソフトがありますが、その機能の一つにオリジナルカードのインポート機能があります。カードの作成方法はテキスト … Continue reading

Posted in Python | Tagged , , , , | 1 Comment

Python: lxmlのインストール方法

lxml とはXMLやHTMLを扱うPythonのライブラリの一つです。 lxml is the most feature-rich and easy-to-use library for working with XM … Continue reading

Posted in Python | Tagged , , , | Leave a comment

Python: モジュールにテスト関数を定義 – 重複のない乱数(整数MIN以上MAX以下)の生成

ソースコード #!/usr/bin/python # coding: UTF-8 import random def make_randint_list(min, max, cnt, sortflag=False, re … Continue reading

Posted in Python | Tagged , , , , | Leave a comment

Python: 乱数の生成 – random()、randint()、uniform()、seed()メソッド

ソースコード #!/usr/bin/python # coding: UTF-8 # 乱数の生成 | random()、randint()、uniform()、seed()メソッドの使い方 import random # … Continue reading

Posted in Python | Tagged , , , | 3 Comments