Skip to content
Advertisement

Python: converting list of strings into a string which illustrates the list

I’m searching a simple method for converting a list of strings (e.g. ['test 1', 'test 2' , 'test 3'] ) into a string whereby the list of objects doesn’t have some quotation mark. That means in our example ('[test 1, test 2, test 3]'). My first approach was:

JavaScript

Is their a more general way without that replace statement at the background? Cause my problem with that is, that e.g.

JavaScript

results in the string:

JavaScript

and not the desired string:

JavaScript

Advertisement

Answer

Try f-strings:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement