Another minor derived questions: summary=[] for a,b in zip(results['E'],results['B']): summary.append(a+b) ## now the summary is '[0,1, 3, 5, 6,0,0,0]' del summary[0] ## here I wanna remove the first zero, which came from the initial double quote "EB...E", summary.pop() ## here I wanna remove the last three zeros summary.pop() summary.pop() print(summary) ### output is [1,3,5,6] summary='\n'.join(str(summary).split(',')) ### wish the result in one column, with open(base+OUTFILEEXT,"w") as f: f.write(str(summary))
the final result in the output.txt file is: [1 3 5 6] Q1: how can I remove the [1 "[" to only keep 1? Q2 how can I improve above expressions? Thanks,
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor