fork download
  1. import re
  2.  
  3. text = """;500;616;;”YPO_INV”;”KP”;”51D0072”;”YNU”
  4. ;” 6,291.00”;;
  5. ;500;6900;;”YPNV”;”KE”;”53213072”;”YOU”
  6. ;” 6,991.00”;;"""
  7.  
  8. r = re.compile(r'\n^(?!;500)', re.M)
  9. text = r.sub(';', text)
  10.  
  11. print(text)
Success #stdin #stdout 0.04s 64280KB
stdin
Standard input is empty
stdout
;500;616;;”YPO_INV”;”KP”;”51D0072”;”YNU”;;”     6,291.00”;;
;500;6900;;”YPNV”;”KE”;”53213072”;”YOU”;;”     6,991.00”;;