LoginSignup
5
1

More than 5 years have passed since last update.

【python3】配列の要素を文字列に変換して一行表示

Last updated at Posted at 2018-03-31

for文をつかう方法

#入力
array=["a","b","c"]
oneLinerString=""
for x in array:
    oneLinerString += x
print(oneLinerString)

#出力
abc

for文をつかわない方法(joinをつかう)

#入力
array=["a","b","c"]
oneLinerString="".join(array)
print(oneLinerString)

#出力
abc
5
1
2

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
5
1