未分類

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

投稿日:

リストに対して、join メソッドを実行する。

list1 = ['hello, ','good ', 'morning']
str1 = ''.join(list1)
print(str1)

結果

hello, good morning

-未分類

執筆者:


comment

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

関連記事

no image

tex で行列の省略した部分を書く方法

斜めの点列を \ddots として書くのがコツ。\matrix を使うためにパッケージ amsmath を使う。 例 \usepackage{amsmath} \begin{document} $$ …

no image

tex で ξ 記号を表示する

ξ はギリシャ文字のクシー(xi)である。ゼータ(ζ)と間違えないように注意。 例 $\xi$ 結果

no image

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

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

no image

tex の分数のシグマ記号(和)がつぶれないようにする

分子・分母にシグマ記号(和記号)を使うと、小さくつぶれて見にくいことがある。対策として、\displaystyle を使う。 例 $\frac{\displaystyle \sum_{i=1}^{\i …

no image

tex で文章を右寄せにする方法

テキストを \flushright で囲めば良い。 例 \begin{flushright} Lorem, ipsum dolor sit amet consectetur adipisicing e …