要素を None に変更すればよい。
例
arr = [1,2,3,4,5]
print(str(arr))
for i in range(len(arr)):
arr[i] = None
print(str(arr))
結果
[1, 2, 3, 4, 5]
[None, None, None, None, None]
雑記
投稿日:
要素を None に変更すればよい。
arr = [1,2,3,4,5]
print(str(arr))
for i in range(len(arr)):
arr[i] = None
print(str(arr))
[1, 2, 3, 4, 5]
[None, None, None, None, None]
執筆者:seyanen
関連記事
辞書に対して、items() メソッドを使うと、タプルを作成することができる。 例 cities = {‘東京’:1000,’大阪’:700, ‘広島’:100} for a,b in cities. …
文字に tex の記法を使って数式を入力することもできる。 例 import numpy as np from matplotlib import pyplot as plt x = np.linsp …
matplotlib で、x,y の軸上の数値を表示する方法
ax の xtics と ytics を使って表示する。 詳細は次のドキュメントを参照。 https://matplotlib.org/stable/gallery/lines_bars_and_ma …
matplotlib でグラフの背景の色を変える方法(facecolor)
次のように、axes で facecolor を変更すればよい。 例 from matplotlib import pyplot as plt x = [2,7,8] y = [7,1 …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。