Search Results

Showing results 1 to 22 of 22
Search took 0.01 seconds.
Search: Posts Made By: scru ; Forum: Python and child forums
Forum: Python Oct 18th, 2009
Replies: 6
Views: 294
Posted By scru
Not really sure what exactly you're trying to do...
Forum: Python Sep 12th, 2009
Replies: 6
Views: 331
Posted By scru
bytes, as they exist in Python 3.1 are conceptually new to Python (starting with version 3). This isn't to say that 8-bit strings didn't exist before in the form of regular text strings. Note the...
Forum: Python Sep 12th, 2009
Replies: 6
Views: 331
Posted By scru
I happen to think this behavior is consistent (with indexing and slicing rules).

Here's why it makes sense:

bytes and str are not the same. They aren't even conceptually the same.

A bytes...
Forum: Python Sep 6th, 2009
Replies: 4
Views: 276
Posted By scru
Look, not to be harsh or anything, but given you previous posts I think you would be better off reading a book or a wiki or even just a tutorial on Python OOP and maybe Python in general. Really.
Forum: Python Aug 23rd, 2009
Replies: 12
Views: 1,209
Posted By scru
No, please don't do that.

That is okay if the page you are reading is encoded in ascii or utf-8. But if it is encoded in latin-1 (a fairly common encoding in its own right), you can run into...
Forum: Python Jul 15th, 2009
Replies: 2
Views: 250
Posted By scru
Well, I'm not Dan, but here's a little hack adapted from http://www.dotnetspider.com/resources/15834-eject-close-cd-tray.aspx for Python. It's only two lines of code!
To open:

import ctypes...
Forum: Python Jun 19th, 2009
Replies: 31
Views: 1,530
Posted By scru
Aw hell nah. I'm not gonna debug that for you. But, is this supposed to be a game? Why isn't it interactive? If it is, how do I play it? I actually love this silly game.
Forum: Python Jun 8th, 2009
Replies: 4
Views: 269
Posted By scru
Try:


import urllib
import os
import time

open_file=open('html.html','r')
file=open_file.read()
Forum: Python May 29th, 2009
Replies: 2
Views: 815
Posted By scru
If you want to just find out if one string is contained inside another:
strvalue1 in strvalue2

If you want to find out how many occurrences of one string there are in another:
num =...
Forum: Python May 20th, 2009
Replies: 5
Views: 389
Posted By scru
The best way I think is to get a solid foundation in Python 2. That and read up a bit on unicode. Once done, you can just read the "What's new in python 3" page (Google it) and learn everything there...
Forum: Python May 8th, 2009
Replies: 78
Views: 14,664
Posted By scru
Here's an example of a basic window frame in pyQT.

You can get pyQT from here: http://www.riverbankcomputing.co.uk/software/pyqt/download


# Code Example: Display a window in PyQt4
# Python...
Forum: Python May 1st, 2009
Replies: 14
Views: 963
Posted By scru
One of the best nuggets of wisdom I ever got about using Ubuntu (and other Debian based systems) is learn to use apt.

I suppose it applies to whatever package manager that your distribution...
Forum: Python Apr 16th, 2009
Replies: 11
Solved: looping/random
Views: 444
Posted By scru
Do you mean like:


import random


def sample(items, amount):
if amount > len(items):
raise ValueError("Amount incorrect")
r = set()
Forum: Python Apr 12th, 2009
Replies: 4
Views: 357
Posted By scru
Having wxPython installed on a server is pointless. Why? Because when it displays the GUI, nobody sees it.

I think the original poster needs to clarify his/her intentions.
Forum: Python Apr 12th, 2009
Replies: 2
Views: 243
Posted By scru
replace print i with print "*" * i. You may need to initialize i to 1 instead of 0.

EDIT:

Actually, that's the easy way out. The other way which might be the one your tutor is looking for...
Forum: Python Apr 12th, 2009
Replies: 6
Views: 437
Posted By scru
You can take out the entire else part of the statement statement; the else and elif parts of an if statement are optional.

Another way is the pass keyword. Use it to get out of a block that you...
Forum: Python Apr 9th, 2009
Replies: 4
Views: 233
Posted By scru
take the initializers and put them inside the function body, so that you have:


def sum(n):
i = 0
total = 0
...rest of your code starting with while statement


Although, I have...
Forum: Python Apr 8th, 2009
Replies: 14
Views: 614
Posted By scru
What the hell? This is basic math. You fail.
Forum: Python Mar 23rd, 2009
Replies: 11
Views: 663
Posted By scru
Actually I did a bit of research a while back on how Python allocated memory. For types like lists and dictionaries, once they are created (and the space allocated), Python doesn't free the memory...
Forum: Python Feb 14th, 2009
Replies: 4
Views: 331
Posted By scru
Consider this:

Say (just pretend) you have a objects called CD with the following attributes:

shape
size
capacity

[Actions/Methods]
Spin
Forum: Python Feb 4th, 2009
Replies: 5
Views: 315
Posted By scru
I don't want to write it in C because the script is to be used to demonstrate how something can be done in Python.

I really only want the fastest speed that python can offer (as I said, it's just...
Forum: Python Jan 20th, 2009
Replies: 8
Views: 453
Posted By scru
I'll take a little piece of it too:

Q3: 'end' is an argument of the Python2.6/3.0 print function. It tells the function what character to append to the output. I believe that by default it appends...
Showing results 1 to 22 of 22

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC