473,811 Members | 2,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dreams-program giving me trouble

52 New Member
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 1163
diegososa
19 New Member
You should search Python doc files about: pickle
Oct 20 '07 #2
bartonc
6,596 Recognized Expert Expert
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
1970
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 want to eliminate the excess attributes and values to get this: <DT><A HREF="http://www.commondreams.org/">Common Dreams</A> I almost succeed with this: $lines=preg_replace("{(<A HREF=\".*\")( ADD.*)(>.*</A>)}","\\1\\3", $line);
7
1360
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 similar to the following server1:{'hostname':'alpha','os':'posix'} server2:{'hostname':'beta','os':'win'}
53
3566
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 objects/classes, some of which will have hundreds-of-thousands of instances stored in a DB. Our clients will probably have somewhere between 50-200 users working on the app during the day, possibly in mutiple offices, and then a large number of batch...
1
1136
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 have read on this newsgroup. I'm trying to learn a new skill in order to hopefully get a job. My job went to india while I was out on medical leave (carpal tunnel.) My question, I have two JavaScript / Htm pages identical to the one below.
12
1989
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 cell, with Mozilla. But in IE it shows. The difference is that the color code don't have the # sign included. Since that affected the rendering different in browsers, I was very supriced that the W3C validator don't notice that as an error. Or...
11
1405
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 I had ever seen... It was 3a.m.... I knew I had to sleep.... work the next day or rather, in a few hours.... but Python somehow brought out all the logic. All the verbosity of my thought was purified into clean beautiful logic... The Python...
33
2511
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 Netscape though..... Question: I've tried linking & embedding the style tags with no luck. How can I use them inline? I've read that inline style sheets is the way to go if you want them to work in most email clients.......
0
1332
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 connecting with people of different ideas and tastes. call charanjit sharma 09872025881. help us to creat home based information in the feild of local real estate agents make deals final online we have indian/foreigner clients with us let us know to each...
0
3017
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
1087
by: hux19383 | last post by:
cabbage patch dreams http://cracks.12w.net F R E E
0
9727
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10398
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7669
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6889
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.