<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open source blog, linux, php, python, security &#187; dict</title>
	<atom:link href="http://www.alonon.net/tag/dict/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alonon.net</link>
	<description></description>
	<lastBuildDate>Sat, 04 Feb 2012 07:23:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>

   <image>
    <title>Open source blog, linux, php, python, security</title>
    <url>http://0.gravatar.com/avatar/5152c5736f5f8dd9570ffb2f9068e8ab.png?s=48</url>
    <link>http://www.alonon.net</link>
   </image>
		<item>
		<title>Phone Book &#8211; Telefon Defteri Python</title>
		<link>http://www.alonon.net/phone-book-telefon-defteri-python/</link>
		<comments>http://www.alonon.net/phone-book-telefon-defteri-python/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 12:25:32 +0000</pubDate>
		<dc:creator>ALonon</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[dict]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[phone book]]></category>

		<guid isPermaLink="false">http://www.alonon.net/?p=270</guid>
		<description><![CDATA[C++ ile yazdığım telefon defterinin benzerini python ile yazdım. Dict kullandığımdan dolayı aynı isimde iki kişi olmamasına dikkat edin, dilerseniz list yapısına çevirebilirsiniz. Aynı klasörde example.txt&#8217;yi yaratmayı unutmayın ( windows için tam path girmeniz lazım.) Surname kısmını eklemek isterseniz, pdict[name] =(phone,surname) şeklinde ekleyebilirsiniz. This python phone book is about same with c++ one. I used &#8230; <a href="http://www.alonon.net/phone-book-telefon-defteri-python/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>C++ ile yazdığım telefon defterinin benzerini python ile yazdım.<br />
Dict kullandığımdan dolayı aynı isimde iki kişi olmamasına dikkat edin, dilerseniz list yapısına çevirebilirsiniz.<br />
Aynı klasörde example.txt&#8217;yi yaratmayı unutmayın ( windows için tam path girmeniz lazım.)<br />
Surname kısmını eklemek isterseniz, pdict[name] =(phone,surname) şeklinde ekleyebilirsiniz. </p>
<p>This python phone book is about same with c++ one.<br />
I used dict, so you can not add records with same name, you can use list if you want.<br />
Don&#8217;t forget to create example.txt in same path ( for windows you have to write exect path )<br />
if you want to add surname, you can use  pdict[name] =(phone,surname) </p>
<p>python phone book</p>
<pre lang="python">
from pickle import dump, load
fr = open('example.txt','rb')
def add():
    fw = open('example.txt','wb')
    name=raw_input("Name ?\n")
    phone=raw_input("Phone ?\n")
    pdict[name]=phone
    dump(pdict,fw)
    fw.close()
def delete():
    fr = open('example.txt','rb')
    pdict=load(fr)
    fr.close()
    name=raw_input("Name ?\n")
    if pdict.has_key(name):
        del pdict[name]
        fw=open('example.txt','wb')
        dump(pdict,fw)
        fw.close()
    else:
         print "record can not be found"
def list():
    fr = open('example.txt','rb')
    pdict=load(fr)
    for a,b in pdict.iteritems():
        print a+" - "+b+"\n"
    fr.close()
c=0
while(c != 4):
    print "Phone Book\n1 to add \n2 to list\n3 to delete"
    c = int(raw_input("Enter your choice:"))
    if c==1:
        add()
    elif c==2:
        list()
    elif c==3:
        delete()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.alonon.net/phone-book-telefon-defteri-python/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

