0
2

More than 3 years have passed since last update.

【Python】Listを文字列として出力する方法

Last updated at Posted at 2021-03-06

概要

1:文字列を含むlistを文字列に変換
2:数値を含むlistを文字列に変換

検証環境

OS:18.04.5 LTS
Python:3.6.9

方法

文字列を含むlistを文字列に変換

list = ['v','e','r','i','f','y']
print(''.join(list))

# 実行結果
verify

数値を含むリストを文字列に変換

list = [0,1,2,3,4,5]
print(''.join(map(str,list)))

# 実行結果
012345

data = [0,1,2,3,4,5]
print(*data, sep='')

# 実行結果
012345
0
2
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2