未分類

python3 で、文字列のパーセント(%)をそのまま表示する方法

投稿日:

文字列の始まりに r をつけて、raw 文字列にするとパーセントなどの文字をそのまま表示できる。

str1 = r'%s%d\t'
print(str1)

結果

%s%d\t

-未分類

執筆者:


comment

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

関連記事

no image

tex 表の一部の列のみを中央揃えにする

中央揃えにしたい列を、c で指定すればよい。その他は l (左)または r (右)揃えに指定する 例 \begin{table} \begin{tabular}{ |r|c|r|} \hline Ta …

no image

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

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

no image

tex で和集合を入力する方法

\bigcup を使う。 例 $\displaystyle \bigcup _ {i \in \Lambda} A_i $ 結果

no image

tex で差集合の記号を入力する方法

\setminus を使う。 例 $A \setminus B$ 結果

no image

tex の表で、複数行を1行内に入れる方法

multirow パッケージを使っておき、表内で multirow で入力する。 例 \usepackage{multirow} \begin{document} \begin{table} \beg …