Forum: Python 1 Day Ago |
| Replies: 5 Views: 135 I don't understand why someone modded the OP down. He clearly showed effort in his homework, and has a legitimate newby question. |
Forum: Python 4 Days Ago |
| Replies: 10 Views: 273 OK, you want the code to look in the directory you specified for the files, but you never actually specify that the program should be running in that directory. You list files from the directory,... |
Forum: Python 4 Days Ago |
| Replies: 12 Views: 283 Exactly. You could use the urllib2 library to connect to a website and pull down a file with the latest version number of your software. Then compare that to the version number that you have as the... |
Forum: Python 4 Days Ago |
| Replies: 10 Views: 273 I might be on to something for you. First I took out the print line that you have at line 24. Then I put in this statement at line 23, right before the rename happens.
temp = raw_input('about... |
Forum: Python 5 Days Ago |
| Replies: 12 Views: 283 One thing you could try doing is to give the user two different programs. Prog1 is the auto updater and Prog2 is the twitter client. The user will always run prog1. Prog1 will check for a version... |
Forum: Python 5 Days Ago |
| Replies: 6 Views: 221 So you're going to ask the user to put in a starting temperature
start_temp = int( raw_input('Enter a temperature: ') )
Then you need to give the user some kind of menu or options
choice =... |
Forum: Python 5 Days Ago |
| Replies: 2 Views: 142 Add this in line 12 and I think you'll see it getting called.
print "__str__ has been called."
The __str__ is called when you try to turn something that is not a string (in this case a... |
Forum: Python 5 Days Ago |
| Replies: 2 Views: 139 I have some processes that I need to keep running on a linux host. For some reason the processes are dying (possibly being killed by another admin). I can hunt that down later, right now I need to... |
Forum: Python 5 Days Ago |
| Replies: 5 Views: 193 CWD is the directory that your script is running in. If you want to change the CWD that your script is using, you can use os.chdir()
Line 7 of your original script would change to... |
Forum: Python 5 Days Ago |
| Replies: 10 Views: 440 if assignment.hard or self.lazy:
submit_to_daniweb(assignment)
else:
self.DoHomework(assignment) |
Forum: Python 5 Days Ago |
| Replies: 5 Views: 193 I think that line 14 might be your problem. Even though you ask the user for a path on line 5, you perform your renaming on the operating systems current working directory (CWD) on line 14. I think... |
Forum: Python 5 Days Ago |
| Replies: 4 Views: 45 Another thing you can do to add to the security of the application is to add a "seed" value to the stored passwords. You store the seed value along with the password. Then when the user provides a... |
Forum: Python 5 Days Ago |
| Replies: 4 Views: 45 One thing you might want to consider is writing the code so that the users password isn't stored in clear text. The way to do this is to hash the user's password with a cryptographic algorithm and... |
Forum: Python 6 Days Ago |
| Replies: 5 Views: 233 I didn't even have the IDLE problems...which absolutely plagued me on Vista. Everything was great. |
Forum: Python 8 Days Ago |
| Replies: 5 Views: 233 I have installed and run python on my Windows 7 Enterprise machine at work. I had no problems with the installer or a simple wxPython application. |
Forum: Python 11 Days Ago |
| Replies: 9 Views: 284 |
Forum: Python 13 Days Ago |
| Replies: 9 Views: 284 Oh yeah, I understand the version changes and I actually appreciate them. I'm just still trying to decide if I should start writing my classes with that object parameter or not. I'm not seeing what... |
Forum: Python 13 Days Ago |
| Replies: 9 Views: 284 OK, I read the paper that was linked to above and the comments in this thread so far.
So back in the old days, before Python 2.3 we only had Classic Classes and we created them using this syntax
... |
Forum: Python 13 Days Ago |
| Replies: 3 Views: 400 I guess it depends on what you mean by simplify. If you mean fewer lines of code, then yeah there are ways to simplify it.
If you mean make the code more readable so that the next person who has... |
Forum: Python 13 Days Ago |
| Replies: 9 Views: 284 Difficult to say without more context. Is the author talking about inheritance at that point? |
Forum: Python 15 Days Ago |
| Replies: 11 Views: 303 Have you considered looking at the source code for some other implementation of SHA1?
I took a look at the hashlib.py file (which is where python implements sha1) and it looks to me like it is... |
Forum: Python 15 Days Ago |
| Replies: 11 Views: 303 Unfortunately I don't understand the encryption algorithm well enough to figure out where you code is going wrong. |
Forum: Python 16 Days Ago |
| Replies: 4 Views: 222 You're probably going to want to use some recursion when you're searching through the directories. If you copy subfolders you're going to want to know if the files in the subfolders have also copied... |
Forum: Python 16 Days Ago |
| Replies: 11 Views: 303 On my system (which is running Ubuntu linux) your code is working as expected for small files.
From the command line I created a small file using the touch command and put a small amount of data... |
Forum: Python 18 Days Ago |
| Replies: 11 Views: 303 When you reply you should find an option to put in a link. You can also attach a file to your post so that you don't have to make a gigantic post with all of the code in it. |
Forum: Python 18 Days Ago |
| Replies: 12 Views: 404 I've only done this one time, and I found that I had to use sys.stdout.flush() before I wrote the \b characters. Just in case you run into any problems. |
Forum: Python 18 Days Ago |
| Replies: 11 Views: 303 You said that when you hash a string (not a file) that your algorithm and the sha1 library come back with the same results? That's awesome! You're definitely close.
What length of string are we... |
Forum: Python 20 Days Ago |
| Replies: 3 Views: 188 What is the load_airports function? Are you sure that it is returning something into your dictionaries? |
Forum: Python 20 Days Ago |
| Replies: 14 Views: 522 It doesn't look like you're using a dictionary. It appears that you have a list of tuples, and each tuple consists of a string and a list.
I can't think of a built in way to do this. You might... |
Forum: Python 20 Days Ago |
| Replies: 2 Views: 160 No,that doesn't quite work. What you would be doing is assigning the key 'Boo' to have the same value as they key 'Hoo'. The question wants you to change the value of dict1['Boo'] to 'Hoo'
>>>... |
Forum: Python 20 Days Ago |
| Replies: 16 Views: 351 What error are you getting? It seems to run fine for me.
>>> import math
>>> def distance(p1, p2):
... return float(math.sqrt((p2-p1)**2+(p2-p1)**2))
...
>>> print distance(1,6)... |
Forum: Python 24 Days Ago |
| Replies: 14 Views: 399 Or you could use isalpha() like vegaseat did and stop being a chode like me. |
Forum: Python 24 Days Ago |
| Replies: 14 Views: 399 First of all, bravo to snippsat for a very elegant solution. I have never seen string splicing like that.
Now, how to remove the spaces and symbols? Well there is the easy inefficient way and the... |
Forum: Python 25 Days Ago |
| Replies: 16 Views: 908 First open a file for writing
outFile = open('/home/figved/file.txt','w')
Then replace your print statement with this. I have never used BeautifulSoup so I don't know about the encoding... |
Forum: Python 25 Days Ago |
| Replies: 14 Views: 399 There is no built in function that I know of to check that.
On thing you might try doing is reversing the string and then comparing each element.
inString = 'racecar'
reversestring = ''
for... |
Forum: Python 26 Days Ago |
| Replies: 8 Views: 228 Use the first code snippet that I put in my last post so that you can strip off the first and last lines of the file.
Now if you want a list that only contains the stuff in the 6th column, you... |
Forum: Python 26 Days Ago |
| Replies: 10 Views: 459 I think both would work really well, but you'll have an easier time getting support if you're using PHP because that is a very common setup. PHP makes it really easy to grab the form fields and it... |
Forum: Python 26 Days Ago |
| Replies: 8 Views: 306 I think Pythopian gets the award for most elegant code. That is just beautiful. |
Forum: Python 26 Days Ago |
| Replies: 8 Views: 228 Remember, the first thing you want to do is read in the input, so start by working out that problem. Read in the file and strip off the first and last lines:
infile = open('grades1.txt','r')... |
Forum: Python 27 Days Ago |
| Replies: 3 Views: 147 Keep in mind that vegaseat's solution will only show you when the photo was created in the filesystem. If you took the photo on a digital camera and then put it on your computer three days later,... |