comment

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

関連記事

no image

C言語でchar文字列の長さを取得する (strlen)

strlen 関数を使って取得すればよい。sizeof という関数もあるが、strlen と振る舞いが異なるので注意。 例 #include<stdio.h> #include<strin …

no image

pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。

next() を使う。 例 my_arr = [‘春’,’夏’,’秋’,’冬’] my_iter = iter(my_arr) print(next(my_iter,’なし’)) print(next …

no image

python3 で文字列のリストを結合して1つの文字列にする方法

リストに対して、join メソッドを実行する。 例 list1 = [‘hello, ‘,’good ‘, ‘morning’] str1 = ”.join(list1) print(str1) 結 …

no image

python3 でファイルに内容を追記する方法

ファイルを開くとき、「a+」を指定することで、data.txt というファイルを書き込みモードで開く。(もしファイルが存在していなければ作成する。) 例 f = open(‘data.txt’, ‘a …

no image

matplotlib で縦横の罫線を出力する

罫線を出力するには、pyplot.grid を使う。 例 import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2 …