def __str__(self)outstring "'{ }'{ }{ }formatself nameself ageself marriedreturn outstring this is shortened class normallyyou' add accessors (getter and setter methodsand error-trapping code (remember that getter methods provide read-only access to class data and setter methods provide write-only access to class data howeverthe class works fine for the demonstration the main feature to look at is the __str__(function notice that it formats the output data in specific way the string valueself nameis enclosed in single quotes each of the values is also separated by comma this is actually form of standard output formatcomma-separated value (csv)that is used on wide range of platforms because it' easy to translate and is in plain textso nothing special is needed to work with it save the code as formatteddata py open another python file window type the following code into the window -pressing enter after each linefrom formatteddata import formatdata newdata [formatdata("george" true)formatdata("sally" false)formatdata("doug" true)for entry in newdataprint(entrythe code begins by importing just the formatdata class from formatteddata in this caseit doesn' matter because the formatteddata module contains only single class howeveryou need to keep this technique in mind when you need only one class from module most of the timeyou work with multiple records when you save data to disk you might have multiple paragraphs in word processed document or multiple recordsas in this case the example creates list of records and places them in newdata in this casenewdata represents the entire document the representation will likely take other forms in production applicationbut the idea is the same