473,399 Members | 2,858 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,399 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 1145
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
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.