943,582 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 1149
  • Python RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Jul 3rd, 2009
0

Re: Adress book

oh right ok, thanks, however for the replacement problem, could you just use a unique decision?
Reputation Points: 35
Solved Threads: 32
Posting Pro in Training
leegeorg07 is offline Offline
428 posts
since Jul 2008
Jul 3rd, 2009
0

Re: Adress book

Click to Expand / Collapse  Quote originally posted by leegeorg07 ...
oh right ok, thanks, however for the replacement problem, could you just use a unique decision?
Don't quite understand what you mean with 'unique decision', can you give an example?
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Jul 4th, 2009
0

Re: Adress book

well the simplest version for unique is to use a set where you would incorporate both of them in a set making sure the new information is first like:
python Syntax (Toggle Plain Text)
  1. mydata = ['hello', 'test', 'change']
  2. mynewdata = ['hello', 'test', 'change']
  3. myset = set(mynewdata, mydata)
although having thought of that it would be better to use
python Syntax (Toggle Plain Text)
  1. file = open('filename', 'r+')
so that you will overwrite it, but you can still read it
Reputation Points: 35
Solved Threads: 32
Posting Pro in Training
leegeorg07 is offline Offline
428 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: wxPython Error
Next Thread in Python Forum Timeline: Help updating images and texts





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC