this is my first attempt on python and i would really love some help heres my code

class Customers(object):
    def __init__(self, Surname = None, FirstName = None, Address = None, Town = None, Postcode = None, PhoneNumber = None, Date = None, Email = None):
        self.Surname = Surname
        self.FirstName = FirstName
        self.Address = Address
        self.Town = Town
        self.Postcode = Postcode
        self.PhoneNumber = PhoneNumber
        self.Date = Date
        self.Email = Email

    def printinfo(self):
        print("Surname:", self.Surname)
        print("FirstName:", self.FirstName)
        print("Address:", self.Address)
        print("Town:", self.Town)
        print("Postcode:", self.Postcode)
        print("Phone Number:", self.PhoneNumber)
        print("Date:", self.Date)
        print("Email:", self.Email)

c = Customers("bob", "Samantha", "2 heather road", "Basingstoke", "RG21 3SD", "01256 135434", "23/04/1973", "sam.jackson@hotmail.com")

print ("who are you looking for?") 

myFile = open("Address Book for A453_QP2.csv")
addressbook = []
for eachList in myFile:
    nospaces = eachList.strip()
    addressInfo = eachList.split(",")
    print(addressInfo[0], addressInfo[1], addressInfo[2], addressInfo[3], addressInfo[4], addressInfo[5])
    c = Customers([addressInfo[0], addressInfo[1], addressInfo[2], addressInfo[3], addressInfo[4], addressInfo[5]])
4 Years
Discussion Span
Last Post by pyTony

Here is your print function transformed to conform common style rules of PEP8

from __future__ import print_function

class Customers(object):
    def __init__(self, sur_name = None, first_name = None, address = None, town = None, post_code = None, phone_number = None, date = None, email = None):
        self.sur_name = sur_name
        self.first_name = first_name
        self.address = address
        self.town = town
        self.post_code = post_code
        self.phone_number = phone_number
        self.date = date
        self.email = email

    def __str__(self):
        return """\
Surname:      %s
FirstName:    %s
Address:      %s
Town:         %s
Postcode:     %s
Phone Number: %s
Date:         %s
Email:        %s""" % (self.sur_name, self.first_name, self.address, self.town, self.post_code, self.phone_number, self.date, self.email)

c = Customers("bob", "Samantha", "2 heather road", "Basingstoke", "RG21 3SD", "01256 135434", "23/04/1973", "sam.jackson@hotmail.com")

Edited by pyTony

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.