forked from ilkermanap/python-ornek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrehber.py
67 lines (54 loc) · 1.65 KB
/
rehber.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
class Kisi:
def __init__(self,tcno, adi,soyadi,sehir, meslek, tel, adres):
self.tcno = tcno
self.adi = adi
self.soyadi = soyadi
self.sehir = sehir
self.meslek = meslek
self.tel = tel
self.adres = adres
def rapor(self):
print "Adi :", self.adi
print "Soyadi :", self.soyadi
print "TC No :", self.tcno
print "Sehir :", self.sehir
print "Meslek :", self.meslek
print "Telefon:", self.tel
print "Adres :", self.adres
def csv(self, ayirac = ";"):
a = ayirac
b = self.adi + a
b += self.soyadi + a
b += self.tcno + a
b += self.sehir + a
b += self.meslek + a
b += self.tel + a
b += self.adres
return b
class Rehber:
def __init__(self, adi):
self.adi = adi
self.kisiler = {}
def ekle(self, kisi):
self.kisiler[kisi.tcno] = kisi
def rapor(self):
print "-" * 50
print self.adi, " Rehberi"
print "-" * 50
for tcno, kisi in self.kisiler.items():
kisi.rapor()
print "-" * 50
def csv(self):
print "adi;soyadi;tcno;sehir;meslek;tel;adres"
for tcno, kisi in self.kisiler.items():
print kisi.csv()
if __name__ == "__main__":
r = Rehber("Ev Telefon")
a = Kisi("1", "Nurullah", "Caliskan", "Mugla","Ogrenci","0000","Mugla/Milas")
b = Kisi("2", "Abdullah", "Caliskan", "Mugla","Ogrenci","0100","Mugla/Milas")
c = Kisi("3", "Ilker", "Manap", "Stokholm","Muhendis","00230","Stokholm/Alvsjo")
r.ekle(a)
r.ekle(b)
r.ekle(c)
r.csv()
r.rapor()