Avatar ·

How to change lists in Python 3.X

📁 List, Advanced Python Topics

There is a text file with this content "D11I14V17A8N7R11H16R18P18E5H18I18X8O16Y5S13D1X6U4A20C2P2O14J5I11L5K6Y4X19N17H1E17Q5Z1U1K6U8L11N14K6". I wrote a code that splits the letter values into one list and the digit values into another. How to correctly transform the data from the lists so that the result is D*11 = DDDDDDDDDDD and so on? Code below:


import rec = []
d = []
result = 0
with open('dest.txt', 'r') as s:
    for line in s: