[PYTHON] What do you like about how to convert an array (list) to a string?

Several ways to convert an array to a comma-separated string.

Call a method on an array

JavaScript

> ['a','b','c'].join(',')
'a,b,c'

Ruby

> ['a','b','c'].join(',')
=> "a,b,c"

Call a method on a string

Python

>>> ",".join(['a','b','c'])
'a,b,c'

Other

Java

List<String> list = Arrays.asList("a","b","c");
String result = String.join(",", list);

Recommended Posts

What do you like about how to convert an array (list) to a string?
Convert a string to an image
How to convert an array to a dictionary with Python [Application]
How to make a string into an array or an array into a string in Python
Note: [Python3] Convert datetime to a string in any format you like
Convert a multidimensional list (array) to one dimension
How to convert / restore a string with [] in python
How to import a file anywhere you like in Python
How to connect the contents of a list into a string
What to do if you get a minus zero in Python
What to do if you get angry with'vertices' must be a 2D list ... in matplotlib arrow
[Memorandum] What to do when a warning appears after executing pip list
How to convert Python to an exe file
What to do if you couldn't send an email to Yahoo with Python.
[Python] How to invert a character string
Python --How do you split a list into evenly sized chunks in Python?
What to do if you get a TypeError with numpy min, max
Do you make something like a rocket?
What to do if you get an error when trying to load mnist
What to do if you get an error when installing Dlib (Ubuntu)
Let's summarize what you want to do.
What to do when a warning message is displayed in pip list
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
What to do if you get a "No versions found" error in pipenv
How to achieve something like a list of void * (or variant) in Go?
What to do if Django can't load an image from a static folder
[Tentative] How to convert a character string to Shift_jis with kivy-ios Memo kivy v1.8.0
What to do if you get an error when installing python with pyenv
What to do when you want to receive files from a Windows client remotely
How to share a virtual environment [About requirements.txt]
How to clear tuples in a list (Python)
How to embed a variable in a python string
How to create a function object from a string
What to do if you can't pipenv shell
Would you like to make a Twitter resume?
How to read an array with Python's ConfigParser
How to remember when you forget a word
What to do if you get an "unknown service" error from your gRPC server
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What you can understand because you are a beginner How to create a file (first post)
A story about how Windows 10 users created an environment to use OpenCV3 with Python 3.5
What to do if you get an error when importing matplotlib in Python (Mac)
You can do it in 3 minutes! How to make a moving QR code (GIF)!
How to install and use pyenv, what to do if you can't switch python versions
What to do if you run python in IntelliJ and end with an error
Convert a slice object to a list of index numbers
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
How to convert a class object to a dictionary with SQLAlchemy
[Python] How to expand variables in a character string
What to do when gdal_merge creates a huge file
How to write a list / dictionary type of Python3
Links to do what you want with Sublime Text
How to turn a .py file into an .exe file
How to convert a mel spectrogram back to a wav file
What to do if a UnicodeDecodeError occurs in pip
How to deploy a Go application to an ECS instance
What is pip and how do you use it?
What to do when you can't bind CaboCha to Python
Make a note of what you want to do in the future with Raspberry Pi
What to do if you get an Undefined error:'Module_six_moves_urllib_parse' object has no attribute'urlencode' on MacOS