4

I have two lists and the first one is having additional data (102) when compared to the second one.

First List:

['102 1 1 v-csm CSM vCSM enabled active up D:042 H:20 M:14 S:58 5.4.4.4-68.REL']

Second List:

['2  1 v-csm  CSM  vCSM  enabled active up  D:331 H:12 M:20 S:33  5.4.4.4-68.REL']

I want to insert a string like "xyz" at the first position of the list so that using pandas data can be mapped to correct columns.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Vishal Mishra
  • 41
  • 1
  • 1
  • 3
  • Does this answer your question? [What's the idiomatic syntax for prepending to a short python list?](https://stackoverflow.com/questions/8537916/whats-the-idiomatic-syntax-for-prepending-to-a-short-python-list) – Gino Mempin Jan 19 '21 at 00:30

1 Answers1

10

Let's say that the second list is called array.

You can use array.insert(0, "xyz") or array = ["xyz"] + array to add "xyz" to the beginning of the second list.

Community
  • 1
  • 1
Adi219
  • 4,712
  • 2
  • 20
  • 43