0

Let, a list

name=["new","text","test"]

now, I want to concatenate the first two index values of the list name and make a single index value

new_name=["new text"]
  • Have a look at https://stackoverflow.com/questions/4435169/how-do-i-append-one-string-to-another-in-python – Rm4n Aug 18 '21 at 06:50

2 Answers2

1

Try this:

new_name = [ name[0]+ ' ' +name[1] ]
odog
  • 31
  • 6
1

You can do:

name=["new","text","test"]
new_name=' '.join(name[:2])