comment

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

関連記事

no image

tex で数式モード内に普通の文字列を入力する方法

\textrm を使う。 例 $$y = f (x) \hspace{1cm} \textrm{This is a function.}$$ 結果

no image

python3 で、文字列の末尾の文字を削除する方法

[:-1] で、最後の文字を取り除いた文字列を取得することができる。 例 str1 = “こんにちは。” result = str1[:-1] print(result) 結果 こんにちは

no image

c++ で文字列が他の文字列を含むか判定する方法

文字列を含むかどうか判定するには、string の find を使う。見つからなかった場合は、std::string::npos を返す。 例 #include <iostream> #i …

no image

matplotlib で x軸・y軸ラベルをつける

plt.xlabel と plt.ylabel を使う。 例 import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, …

no image

python3 でリストの偶数番目・奇数番目の項目を出力する

リストに対して、::2 を使えば良い。 例 list1 = [‘日’,’月’,’火’,’水’,’木’,’金’,’土’] list2 = list1[::2] list3 = list1[1::2] p …