Avatar ·

How to change lists in Python 3.X

📁 список, python

There is a text file with this content "" D11I14V17A8N7R11H16R18P18E5H18I18X8O16Y5S13D1X6U4A20C 2P2O14J5I11L5K6Y4X19N17H1E17Q5Z1U1K6U8L11N14K6 ". I wrote a code that divides the letter values ​​into one list, digital in another. How to change the data from the list correctly, so that it ultimately tued out to be d * 11 = DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD Code below:

   import  rec = [] d = [] result =  0    with   open  ( '' dest.txt ', ' `)  as  s:   for  line  in  s:  line.strip ()  lst = re.split ( '(\ d*)' , line)   for  i  in  lst:   if> i.isalpha () ==  true :  c.ppend (i)   else :  d.append (i)   for  a, b  in   zip  (c, d):  result += a*b  print  (result)     

result:

  D: \ Python \ LIB \ Re.PY:  212 : futurewaing: split () Requires a non-empty Patte  Match  .  retu  _  compile  (Patte, Flags) .Split (string, maxsplit)---------------------------------------------------------------------------TypeError                                 Traceback (most recent call Last)  & lt; ipython-  input - 22  -24c875dcd30e & gt;  in  & lt; module & gt; ()   16    17   for  a, b  in   zip  (c, d):  --- & gt;  18  result += a*bren  19    20   print  'T Multiply Sequence byn -int of Type'  st  r'