comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

関連記事

no image

python で文字列の長さを表示する方法

len を使う。 例 length = len(‘文字列あいうえお’) print(str(length)) 結果 8

no image

python3 で辞書(dict) の for ループでキーと値を取得する

キーと値を取得するには次のようにする。キーは dict のループ、値は dict の values() のループで取得できる。 例 mydictionary = {‘color’: ‘白’, ‘ani …

no image

python3 で、文字列を一文字ずつのリストに変換する方法

string を list() で変換すれば良い。 例 str1 = ‘Good morning.’ list1 = list(str1) print(list1) 結果 [‘G’, ‘o’, ‘o’ …

no image

tex で分数がつぶれないようにする

tex で、複数行を書いたときに分数がつぶれないようにする。 displaystyle を使う。 例 first $\frac{1}{1+\sqrt{x}+\sqrt{y}}$ のかわりに、 seco …

no image

python3 でクラスの初期化を __init__ で行う

python でクラスのオブジェクトを生成したとき、__init__ メソッドが呼び出される(コンストラクタ)__init__ の引数には自身(self)を指定することが通例。一方、オブジェクト破棄の …