class Sample:def __init__(self):self.lst_report_footer_strings = ['Manager', 'Accountant', 'Created By', 'fifth', '', '']int_size_of_string = 0lst_temp_report_footer = self.lst_report_footer_stringsfor lst_report_footer_item in self.lst_report_footer_strings:print lst_temp_report_footerprint lst_report_footer_itemif lst_report_footer_item in ('', ' '):print "Inside if : Item ==" + lst_report_footer_itemlst_temp_report_footer.remove(lst_report_footer_item) print "list after remove == " + str(lst_temp_report_footer)else:print "Inside else : length = ", str(len(lst_report_footer_item))int_size_of_string += len(lst_report_footer_item)if __name__ == '__main__':ins_class = Sample()
Output
['Manager', 'Accountant', 'Created By', 'fifth', '', '']
Manager
Inside else : length = 7
['Manager', 'Accountant', 'Created By', 'fifth', '', '']
Accountant
Inside else : length = 10
['Manager', 'Accountant', 'Created By', 'fifth', '', '']
Created By
Inside else : length = 10
['Manager', 'Accountant', 'Created By', 'fifth', '', '']
fifth
Inside else : length = 5
['Manager', 'Accountant', 'Created By', 'fifth', '', '']Inside if : Item ==
list after remove == ['Manager', 'Accountant', 'Created By', 'fifth', '']
What i need is....
list after remove == ['Manager', 'Accountant', 'Created By', 'fifth']