473,287 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Dreams-program giving me trouble

Hi guys, it's me! Your least favourite tard has returned with noob-questions needing answers. I am working on making a program that will not only record my dreams in a file, but also store them by date, topic, keywords, and level of lucidness.

This is what I have so far:

Expand|Select|Wrap|Line Numbers
  1. ListOfKeywords=[]
  2. ListOfDates=[]
  3. ListOfTopics=[]
  4. LevelOfLucidness=[]
  5.  
  6.  
  7. temporarykeywords=[]
  8.  
  9. for n in [10]:
  10.     InputKeywords=raw_input("Give a keyword for finding this dream again. ")
  11.     temporarykeywords.append(InputKeywords)
  12.     needmore=raw_input("Are there more keywords? ")
  13.     if needmore.lower()=="no":
  14.         break
  15.  
  16.  
  17. for item in temporarykeywords:
  18.     ListOfKeywords.append(item)
  19.  
  20. DateOfDream=raw_input("What date did you have the dream on? ")
  21. if DateOfDream in ListOfDates:
  22.     print
  23. else:
  24.     ListOfDates.append(DateOfDream)
  25.  
  26.  
  27.  
  28. TheTopicIs=raw_input("What topic was the dream on? ")
  29. if TheTopicIs in ListOfTopics:
  30.     print
  31. else:
  32.     ListOfTopics.append(TheTopicIs)
  33.  
  34.  
  35.  
  36. HowLucid=raw_input("How lucid was the dream? ")
  37. if HowLucid in LevelOfLucidness:
  38.     print
  39. else:
  40.     LevelOfLucidness.append(HowLucid)
  41.  
  42.  
  43.  
  44. Recountation=raw_input("Now explain the dream. ")
  45.  
  46. DreamInfo=[temporarykeywords,DateOfDream,TheTopicIs,HowLucid]
  47.  
The problem I've encountered is: I need to make it append the stuff that gets added to the lists on the top to similar lists in another .py file. It also needs to be able to read those lists when I start the program, add all the items in them to the lists in this program, so that no word will ever be repeated in any list in the two files.

That's all for now, but if I get an answer to this, and try to continue, there WILL be more questions, brace yourselves.
Oct 20 '07 #1
2 1142
You should search Python doc files about: pickle
Oct 20 '07 #2
bartonc
6,596 Expert 4TB
Like this:
Expand|Select|Wrap|Line Numbers
  1. import cPickle as db  # an easy database
  2.  
  3. myDatabase = open('dreams.pdb', 'w') # create a file
  4.  
  5. myList = ['hello world']
  6. db.dump(myList, myDatabase) # pickle database
  7. myDatabase.close()
  8. del myList  # you progams quits (simulated)
  9.  
  10.  
  11. # then later
  12.  
  13. myDatabase = open('dreams.pdb') # open the previously created a file
  14. myList = db.load(myDatabase)
  15. myDatabase.close()
  16. print myList
Really, BurnTard; please feel free to ask all the questions that you need to.
Remember: There are no stupid questions; only stupid answers.
Oct 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Red | last post by:
In netscape bookmark files, there are lots of lines like this: <DT><A HREF="http://www.commondreams.org/" ADD_DATE="1091500674" LAST_CHARSET="ISO-8859-1" ID="rdf:#$uiYyb3">Common Dreams</A> I...
7
by: Doug Rosser | last post by:
I'm writing a fairly complicated test framework and keeping configuration data inside ini files that are parsed at runtime by the ConfigParser module. For example, there would be a section...
53
by: john67 | last post by:
The company I work for is about to embark on developing a commercial application that will cost us tens-of-millions to develop. When all is said and done it will have thousands of business...
1
by: Rich | last post by:
Hello, I've been trying to teach myself JavaScript via a book and a number of JavaScript Tutorials Online. I have more understanding of what I am doing, although definetly not has much as what I...
12
by: user | last post by:
Find a page some table cells was made like this: <td width="253" height="10" bgcolor="98a7b2">Some text in white color</td> Since the page background was white I could't see the text inside the...
11
by: yoda | last post by:
It was 2a.m.... I was writing my first enterprise scale application in Python.... the logic just flowed from my mind onto the keyboard and was congealed into the most beautiful terse lines of code...
33
by: amerar | last post by:
Hi All, I can make a page using a style sheet, no problem there. However, if I make an email and send it out to my list, Yahoo & Hotmail totally ignore the style tags. It looks fine in...
0
by: manu | last post by:
Get connected with each other make business relations get benefitted and help me to enlarge this business hub called onlinepromos61.you can't expect how much benefit you people can get by...
0
by: U S Contractors Offering Service A Non-profit | last post by:
" Visionary Dreams " " Leaving New york City leaving to go " GOD noes were i Don't "
0
by: hux19383 | last post by:
cabbage patch dreams http://cracks.12w.net F R E E
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.