Home > database >  how can i remove brackets,parentheses,quotation mark and the comma in between the word and number ra
how can i remove brackets,parentheses,quotation mark and the comma in between the word and number ra

Time:04-02

progress_outcome is a string and the rest 3 variables with _cr are user inputs

detail outcome = []
detail_outcome.append([progress_outcome, pass_cr, def_cr, fail_cr])

def progression_outcome(detail_outcome):

    for x in detail_outcome:
        print(x) 

the output of this is for and example

['Progress - ', 120, 0, 0]
['Progress - ', 120, 0, 0]
['Exclude - ', 40, 0, 80]

I want it like this

Progress - 120, 0, 0
Progress - 120, 0, 0
Exclude – 40, 0, 80

basically how can i remove those additional things how can i remove the for loop to do that.

CodePudding user response:

Don't think of this in terms of removing things. You shouldn't depend on the built-in list formatting when displaying formatted data, use your own format string that does what you want.

for progress_outcome, pass_cr, def_cr, fail_cr in detail_outcome:
    print(f"{progress_outcome}{pass_cr}, {def_cr}, {fail_cr}")
  • Related