Search Results

Showing results 1 to 40 of 395
Search took 0.03 seconds.
Search: Posts Made By: woooee
Forum: Python 3 Days Ago
Replies: 4
Views: 216
Posted By woooee
Numpy will probably already do everything you want http://www.scipy.org/Tentative_NumPy_Tutorial#head-926a6c9b68b752eed8a330636c41829e6358b1d3
Forum: Python 3 Days Ago
Replies: 2
Views: 116
Posted By woooee
You can use a dictionary as a counter, but you first have to convert the key to a tuple. arr=[[10, 2, 10],
[10, 9, 10],
[10, 9, 10],
[10, 9, 10],
[10, 9, 10],
[22, 9, 10],
[10, 9, 10],
[10, 9,...
Forum: Python 4 Days Ago
Replies: 3
Views: 158
Posted By woooee
First, try running this code in Idle. It will tell you that there are problems with this statement with a variable name that contains special characters....
Forum: Python 5 Days Ago
Replies: 3
Solved: Flip
Views: 168
Posted By woooee
The first two posts found in a search of this forum, after your post which is the first/latest, have working solutions that you should be able to adapt.
Forum: Python 9 Days Ago
Replies: 15
Solved: Scorecard
Views: 445
Posted By woooee
I don't think that anyone here is going to give you code that you can take to another forum, claim it is yours, and ask them to finish it for you. Let this thread die.
Forum: Python 11 Days Ago
Replies: 15
Solved: Scorecard
Views: 445
Posted By woooee
Start by asking the player(s) for a name and store it in a dictionary that will also keep track of their score. Then, open one graphic window that will simply display the name and score of the...
Forum: Python 13 Days Ago
Replies: 10
Views: 503
Posted By woooee
if "EMERGENCY" or "Help" or "!" in heading:
pass
elif ("no idea" in body) or (not Code() in body):
pass
Forum: Python 14 Days Ago
Replies: 2
Views: 314
Posted By woooee
I think you could check for a number in the second position, if I understand correctly that overlays use numbers and updates/adds use a letter. if len(line.strip()) and \
not...
Forum: Python 14 Days Ago
Replies: 3
Views: 281
Posted By woooee
So you are obviously using PyQT4 built for Python 2.6. The error message confirms it. Ask how to install PyQT for both 2.6 and 3.x on the Ubuntu or PyQt forum. Some one has done this and if there...
Forum: Python 16 Days Ago
Replies: 4
Views: 282
Posted By woooee
Python does not have static variables, but does have global variables, which those are not. They are class objects and would be called using
Atom.cartesian
both inside and outside the class. In...
Forum: Python 17 Days Ago
Replies: 4
Views: 282
Posted By woooee
You have both class instances and class objects. The variables
cartesian = dict()
bondList = list()
atomName = str()
atomicNum = int()
would point to the same variable (block...
Forum: Python 17 Days Ago
Replies: 6
Solved: While loop
Views: 302
Posted By woooee
That's called string formatting http://www.python.org/doc/2.5.2/lib/typesseq-strings.html (assuming you are using Python 2.5). A simple example: year = 1
pop = 12345
for x in range(2):
print...
Forum: Python 22 Days Ago
Replies: 16
Views: 439
Posted By woooee
Agreed. You should do your own research from here. Especially since you are just going to forget most of this anyway. Herb Schildt was the consensus guru when this was commonly done, so if you can...
Forum: Python 23 Days Ago
Replies: 16
Views: 439
Posted By woooee
If you wanted to draw a box on the screen and display some sort of message, you would have to access the memory on the video card. Before toolkits like Tkinter that is the way it was done. In...
Forum: Python 27 Days Ago
Replies: 7
Views: 229
Posted By woooee
Try this and then go to the page from the earlier link which explains why you returned a tuple. def junk(f):
d1 = {}
d2 = {}
for line in f:
columns = line.split(":")
...
Forum: Python 27 Days Ago
Replies: 7
Views: 229
Posted By woooee
First you are not returning a dictionary. I've added a print statement to show that. Also, take a look at "returns" and "arguments" here http://www.penzilla.net/tutorials/python/functions/ for the...
Forum: Python 27 Days Ago
Replies: 2
Views: 300
Posted By woooee
It is generally done with a list. def test_input(input_str):
accept_list = []
for x in range(0, 10):
accept_list.append(str(x))
accept_list.append("d")
accept_list.append("r")...
Forum: Python 28 Days Ago
Replies: 5
Views: 484
Posted By woooee
It should be simple with Python's gstreamer interface. http://pygstdocs.berlios.de/
Forum: Python 28 Days Ago
Replies: 16
Solved: Pythagoras?
Views: 397
Posted By woooee
Not enough info for anyone to help (could be an indentation error, or could be in the calcs). First add some print statements for the individual calcs to isolate the error, and post the specific...
Forum: Python 29 Days Ago
Replies: 8
Views: 267
Posted By woooee
finderGuess = finderGuess - ((((finderGuess*((1+finderGuess)^numberMonths))/(((1+finderGuess)^numberMonths)-1))-
(monthlyPayment/loanAmount))/(((((1+finderGuess)^numberMonths)-1)
...
Forum: Python 29 Days Ago
Replies: 9
Views: 689
Posted By woooee
There are several online pages to do that.
http://primes.utm.edu/curios/includes/primetest.php
is one found on this very good page
http://primes.utm.edu/

Your program works correctly, at least...
Forum: Python 30 Days Ago
Replies: 9
Views: 258
Posted By woooee
All data is binary. That's the way the computer does it. I am assuming that you mean bytes that are not text. If you look at an ASCII table like this one http://www.asciitable.com/ it becomes...
Forum: Python 32 Days Ago
Replies: 9
Views: 689
Posted By woooee
Wouldn't this lead to an infinite loop. def Prime(x,y):
n=2
if x == 1:
Prime(x+1,y)
elif x == 2:
print (2)
Prime(x+1,y)
elif x <= 0:
print ("Number must...
Forum: Python 34 Days Ago
Replies: 8
Solved: neeed help!!!
Views: 233
Posted By woooee
You want to use "readlines()",as readline reads one line at a time, where readlines() reads all data. Also, a print statement is added for clarity.records = open(grades.txt,'r').readlines()
table =...
Forum: Python 34 Days Ago
Replies: 3
Views: 240
Posted By woooee
And it's not tough to do. import Tkinter

root = Tkinter.Tk()
root.title('Canvas')
canvas = Tkinter.Canvas(root, width=450, height=450)

canvas.create_oval(100,50,150,100, fill='gray90')

x =...
Forum: Python Oct 30th, 2009
Replies: 4
Solved: Distinct Vlaues
Views: 237
Posted By woooee
This is very simple to do. print len(set([1,2,4,2,7]))
Forum: Python Oct 27th, 2009
Replies: 5
Views: 362
Posted By woooee
Google came up with this site which has a link to download source code. I hope you didn't pay $99.95 for the book! http://www.jbpub.com/catalog/9780763746025/
Forum: Python Oct 27th, 2009
Replies: 11
Views: 467
Posted By woooee
You can modify it on startup by adding PYTHONPATH to your ~/.bash.rc file, or create one if you don't have it.
export PYTHONPATH=$PYTHONPATH:/path/to/add:/second/path
Forum: Python Oct 24th, 2009
Replies: 7
Views: 304
Posted By woooee
Always use absolute path+file names.filePath = "Dataset/parameter feature vectors"
for fname in os.listdir(filePath):
complete_name = os.path.join(filePath, fname)
data_str =...
Forum: Python Oct 22nd, 2009
Replies: 9
Solved: Be gentle
Views: 276
Posted By woooee
Alternatives would be: while (play_choice < 1) or (play_choice > 3):

while play_choice not in [1, 2, 3]:

# Also, you can use .lower instead of 2 compares
while play_again.lower() == 'y'':
Forum: Python Oct 19th, 2009
Replies: 8
Solved: List help...
Views: 216
Posted By woooee
Using for() loops is easier. This is somewhat of a brute force method but works fine for smaller lists. L1=[[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
L2=[1,2,3,4,11]
L3=[]

for number in L2:
...
Forum: Python Oct 16th, 2009
Replies: 3
Views: 250
Posted By woooee
You can pipe top to a file on Linux and then read the file.

Apparently you can use WMI for MS WIndows but I have not used it http://timgolden.me.uk/python/wmi_cookbook.html#running_processes
Forum: Python Oct 16th, 2009
Replies: 6
Views: 263
Posted By woooee
Please ass "Solved" to the thread title so no one else wastes their time on this.
Forum: Python Oct 15th, 2009
Replies: 12
Views: 476
Posted By woooee
Dictionaries are indexed via a hash and so make it easy to look up things, in this case the stock symbol, without going through the sub-strings in each list. Also, they provide a convenient way to...
Forum: Python Oct 15th, 2009
Replies: 6
Views: 263
Posted By woooee
Can you use a list instead of all of those variables? Otherwise, try the code below which tests each button individually instead of the confusing and, and, or, etc. in your code. Speaking of...
Forum: Python Oct 15th, 2009
Replies: 12
Views: 476
Posted By woooee
Doug Hellmann has excellent write ups. http://www.doughellmann.com/PyMOTW/

As far as books go, I like "Dive into Python" http://diveintopython.org/native_data_types/index.html#odbchelper.dict
Forum: Python Oct 15th, 2009
Replies: 12
Views: 476
Posted By woooee
This will get you started, but a dictionary would work much better for this. elif stChoice == 2:
for stock_list in portfolio:
print "symbol = %s for %s" % (stock_list[1], stock_list[0])...
Forum: Python Oct 14th, 2009
Replies: 13
Views: 907
Posted By woooee
You would have to step through the unicode and count the number of actual letters, and then add enough spaces to the string to make it the length you want. This appears to work, but you'll have to...
Forum: Python Oct 13th, 2009
Replies: 18
Views: 636
Posted By woooee
You want to keep all of the sqlite stuff in Database.py and call the add, change, delete functions from the WX program. An example using addition. import sqlite3
##import addnew

class DBClass:
...
Forum: Python Oct 12th, 2009
Replies: 18
Views: 636
Posted By woooee
If you didn't close the database
connection.commit()
db.close()
you sould be able to access it via Database.db from the second program so try substituting that for self.database and see if it...
Showing results 1 to 40 of 395

 


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

©2003 - 2009 DaniWeb® LLC