Bottom Page

Thread Rating:
  • 3 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"add to list" function
#1
The following function should generate a list from my class - right?

def to_list(self):
        return [self.customer_id, self.firstname, self.lastname, self.born, self.zip_code
Quote
#2
Well, it needs a closing bracket (]) at the end of the second line, but otherwise, yeah. Note that you have to put that indented under the class definition (to automatically pass self), or you need to manually pass the function an instance of your class.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote
#3
Thanks! Lost the bracket while pasting the code in here.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  List creation and return in Function leoahum 3 77 Mar-04-2019, 04:45 PM
Last Post: leoahum
  Function to return modified list Pjones006 2 108 Feb-06-2019, 10:57 PM
Last Post: Pjones006
  Making list empty after return in function dan789 10 472 Nov-24-2018, 11:54 PM
Last Post: micseydel
  Run function in parallel but inherite dynamic data from the previous function atizva 4 489 Jul-11-2018, 06:39 AM
Last Post: volcano63
  function 'return' and file content into a list shiro26 4 433 Jul-06-2018, 10:20 PM
Last Post: volcano63
  question about list and remove function wmw12344 5 585 Mar-30-2018, 11:52 AM
Last Post: ljmetzger
  make a list of string in capital by using a function anancba 3 782 Nov-23-2017, 06:42 AM
Last Post: heiner55
  List in function thehimanshukeshri 1 734 Nov-19-2017, 07:58 AM
Last Post: buran
  Calling list from previous function zykbee 1 708 Nov-13-2017, 12:10 PM
Last Post: Larz60+
  View function mapping is overwriting an existing endpoint function: index rarevesselt 12 9,079 Oct-22-2017, 12:34 AM
Last Post: rarevesselt

Forum Jump:


Users browsing this thread: 1 Guest(s)