473,233 Members | 3,106 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,233 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=[]
  7. temporarykeywords=[]
  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
  17. for item in temporarykeywords:
  18.     ListOfKeywords.append(item)
  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)
  28. TheTopicIs=raw_input("What topic was the dream on? ")
  29. if TheTopicIs in ListOfTopics:
  30.     print
  31. else:
  32.     ListOfTopics.append(TheTopicIs)
  36. HowLucid=raw_input("How lucid was the dream? ")
  37. if HowLucid in LevelOfLucidness:
  38.     print
  39. else:
  40.     LevelOfLucidness.append(HowLucid)
  44. Recountation=raw_input("Now explain the dream. ")
  46. DreamInfo=[temporarykeywords,DateOfDream,TheTopicIs,HowLucid]
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 1139
You should search Python doc files about: pickle
Oct 20 '07 #2
6,596 Expert 4TB
Like this:
Expand|Select|Wrap|Line Numbers
  1. import cPickle as db  # an easy database
  3. myDatabase = open('dreams.pdb', 'w') # create a file
  5. myList = ['hello world']
  6. db.dump(myList, myDatabase) # pickle database
  7. myDatabase.close()
  8. del myList  # you progams quits (simulated)
  11. # then later
  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

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...
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...
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...
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...
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...
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...
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...
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...
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 "
by: hux19383 | last post by:
cabbage patch dreams http://cracks.12w.net F R E E
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
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...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
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...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...

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.