[:-1] で、最後の文字を取り除いた文字列を取得することができる。
例
str1 = "こんにちは。" result = str1[:-1] print(result)
結果
こんにちは
雑記
投稿日:
[:-1] で、最後の文字を取り除いた文字列を取得することができる。
str1 = "こんにちは。" result = str1[:-1] print(result)
こんにちは
執筆者:seyanen
関連記事
physics パッケージを使って、\divisionsymbol で割り算記号が入力できる。 例 \usepackage{physics} \begin{document} $2 \division …
plt.xlabel と plt.ylabel を使う。 例 import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, …
multirow パッケージを使っておき、表内で multirow で入力する。 例 \usepackage{multirow} \begin{document} \begin{table} \beg …
例で、urlcolor=red と書けば、「link to google」の文字列は赤色(red)になる。 もし urlcolor=blue と書けば、リンクは青色になる。 例 \usepackage …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。