RSS Forums RSS
Please support our Python advertiser: Programming Forums

File Appendage, check for duplicate first

Join Date: Oct 2006
Posts: 1,746
Reputation: sneekula is on a distinguished road 
Rep Power: 6
Solved Threads: 51
sneekula's Avatar
sneekula sneekula is offline Offline
Posting Virtuoso

Re: File Appendage, check for duplicate first

  #2  
Oct 11th, 2008
If your file is not too large, you can go as simple as this:
  1. newuser = "hamster201"
  2.  
  3. fin = open("MyUserFile.txt", "r")
  4. text = fin.read()
  5. fin.close()
  6.  
  7. if newuser in text:
  8. print "this username already used"
No one died when Clinton lied.
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 8:32 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC