Skip to content
Advertisement

python code to split into multiple nested list

I am having the following input data(temp_list1). I am trying to convert this input into a nested list as mentioned below(new_list). this input is part of vnstat command’s output.

Input:

temp_list1 = [(‘ eno1:’, “rn Oct ’19 10.09 GiB / 68.98 GiB / 79.08 GiB / 164.53 GiBrn yesterday 1.11 GiB / 7.35 GiB / 8.46 GiBrn today 432.51 MiB / 4.22 GiB / 4.65 GiB / 7.17 GiBrnr”), (‘ eno5:’, “rn Oct ’19 18.82 TiB / 18.39 TiB / 37.21 TiB / 77.43 TiBrn yesterday 2.65 TiB / 2.59 TiB / 5.24 TiBrn today 1.95 TiB / 1.90 TiB / 3.85 TiB / 5.95 TiBrnrn”)]

Expected output:

JavaScript

I am trying to split the input data using the python code but do not know how to do it.

JavaScript

Advertisement

Answer

You can try this.

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