Forum: Python 7 Hours Ago |
| Replies: 1 Views: 52 Code Snippets are for finished code, post questions in a regular Python forum thread! |
Forum: Python 7 Hours Ago |
| Replies: 4 Views: 134 The module numpy is your friend here:
# create matrix with arange().reshape()
# perform add and multiply matrix operations
# module numpy (numeric python extensions, high speed)
# free from:... |
Forum: Python 9 Hours Ago |
| Replies: 5 Views: 151 It looks like badboy00z is correct. The last result is really a permutation with a sample size of 2. |
Forum: Python 9 Hours Ago |
| Replies: 5 Views: 151 I think badboy00z is correct. You can use module itertools to show it:
# combinations and permutations using Python3 itertools
import itertools
iterable = [1, 2, 3]
# sample_size <... |
Forum: Python 8 Days Ago |
| Replies: 1 Views: 177 See:
http://www.daniweb.com/forums/post1079895.html#post1079895 |
Forum: Python 8 Days Ago |
| Replies: 130 Views: 51,005 I modified the code in the previous post to join two images into one:
# use a drawing bitmap and wx.MemoryDC to create a canvas you can
# draw on and optionally save the drawing to an image file
#... |
Forum: Python 8 Days Ago |
| Replies: 130 Views: 51,005 I modified the code in the previous post to join two images into one:
# use a drawing bitmap and wx.MemoryDC to create a canvas you can
# draw on and optionally save the drawing to an image file
#... |
Forum: Python 8 Days Ago |
| Replies: 2 Views: 174 Call for update() as shown below:
from tkinter import *
class fb( Frame ):
def fastbuttons( self ):
b = Button(self)
b.grid()
self.update()
print(... |
Forum: Python 8 Days Ago |
| Replies: 2 Views: 181 The module threading is the higher level module and actually uses module thread, since that one has the lower level tasks. So one can assume that threading is somewhat slower in speed, but nicer in... |
Forum: Python 9 Days Ago |
| Replies: 28 Views: 819 If there is no space in the rank or name you can do it this simple way:
mydata = """\
<Ranking: AA (John)>
<Ranking: CA (Peter)>
<Ranking: TA-A (Samantha)>
"""
rank_list = []
for line in... |
Forum: Python 9 Days Ago |
| Replies: 2 Views: 207 Here would be one way to accomplish this:
mylist = [
['A', 60],
['B', 40],
['C', 90],
['B', 150],
['C', 230],
['A', 220]
] |
Forum: Python 15 Days Ago |
| Replies: 2 Views: 251 When you use
os.system('cls')
you limit yourself to the Windows OS.
In 99.9% percent of console apps you really don't need to clear the console screen. |
Forum: Python 15 Days Ago |
| Replies: 8 Views: 279 Well, in Python just about anything is an object not just the typical OOP stuff. I assume that your instructor forgot about that and actualy means creating a class Student where each instance is a... |
Forum: Python 15 Days Ago |
| Replies: 8 Views: 346 Let's be somewhat pleasant about this. If you search on Google for goolge this comes up:
Did you mean: google
Yes, Google uses Python and can figure that out. |
Forum: Python 24 Days Ago |
| Replies: 3 Views: 446 If you search DaniWeb, you will find a whole lot of similar requests about queues, stacks and html tag names. Looks like this homework has been given in the last few weeks to a bunch of folks. The... |
Forum: Python 24 Days Ago |
| Replies: 7 Views: 479 You may also take a look at:
http://www.daniweb.com/forums/thread240778.html |
Forum: Python 24 Days Ago |
| Replies: 7 Views: 385 There is a very similar thread at:
http://www.daniweb.com/forums/thread241913.html |
Forum: Python 25 Days Ago |
| Replies: 11 Views: 590 This little module has been updated to work with Python2 and Python3 recently, look at the new beta version at:
http://mcsp.wartburg.edu/zelle/python/ |
Forum: Python 25 Days Ago |
| Replies: 3 Views: 286 This should give you an idea how to split the window into three parts. One could add to the left side score, the other to the right side score, and the third is for a click to exit.
#
from... |
Forum: Python 25 Days Ago |
| Replies: 3 Views: 286 The title is somewhat misleading. You want to add 2. |
Forum: Python Nov 7th, 2009 |
| Replies: 8 Views: 343 Okay, this might even be mildly better:
import string
a = list(string.ascii_lowercase + "!@#$%^&*()-+={}|\/?><,.'") + range(1, 10)
print a
For Python3 change to list(range(1, 10)). Oh, the... |
Forum: Python Nov 7th, 2009 |
| Replies: 7 Views: 297 What do you mean with "WxGlade does not show value"?
Is it WxGlade or your program you wrote using WxGlade?
Just a note on the smart side of things. If you have a problem for others to look at... |
Forum: Python Nov 7th, 2009 |
| Replies: 130 Views: 51,005 Just testing wxPython's wx.TextCtrl widget used as an edit field for input and output of text based data:
# testing wxPython's
# wx.TextCtrl(parent, id, value, pos, size, style)
# a widget used... |
Forum: Python Nov 7th, 2009 |
| Replies: 8 Views: 343 Also the OP didn't want a zero in the digits part. :) |
Forum: Python Nov 7th, 2009 |
| Replies: 3 Views: 485 It's always good to use a few test prints:
import operator
OPERATORS = {
'+': operator.add,
'-': operator.sub,
'*': operator.mul,
'/': operator.div,
} |
Forum: Python Nov 7th, 2009 |
| Replies: 7 Views: 7,090 Ah, the pros and cons on posting on an old thread.
If you are interested in a regex solution, I would start a new thread and put regex in the title. |
Forum: Python Oct 31st, 2009 |
| Replies: 5 Views: 532 Well, you could do something like this:
# File_lister2.py
# create a list of all the files and sizes in a given direcory
# and optionally any of its subdirectories (Python2 & Python3)
# snee
... |
Forum: Python Oct 31st, 2009 |
| Replies: 209 Views: 102,430 Here is a simple number project:
Prime numbers are positive integer numbers that are only divisible by itself or one. For example 2, 3, 5, 7, 11, 13, 17, are prime numbers, by convention 1 is not... |
Forum: Python Oct 31st, 2009 |
| Replies: 8 Views: 337 You could do:
for c in "Hello World":
print c ,
In Python2 the comma puts in a space and keeps it on the same line. |
Forum: Python Oct 30th, 2009 |
| Replies: 6 Views: 288 You are somewhat confused about functions. |
Forum: Python Sep 21st, 2009 |
| Replies: 9 Views: 418 I made an attempt on user friendly data entry with just such a simple temperature converter program, see:
http://www.daniweb.com/forums/post992595.html#post992595 |
Forum: Python Sep 21st, 2009 |
| Replies: 197 Views: 89,768 The ultimate user friendly Temperature Converter program. If you put an 'F' or 'f' on the end of the temperature you enter it will give you Celsius. Otherwise it simply assumes you entered a... |
Forum: Python Sep 21st, 2009 |
| Replies: 4 Views: 397 As a beginner use for loops first, later on 'list comprehensions' become more natural. |
Forum: Python Sep 21st, 2009 |
| Replies: 10 Views: 401 Looks like one of the 638 web pages is not available. You should use a try/except trap for this case. |
Forum: Python Sep 21st, 2009 |
| Replies: 4 Views: 324 At first, I would adopt consistent indentations! Very important in Python. Most people use 4 spaces. |
Forum: Python Sep 21st, 2009 |
| Replies: 4 Views: 763 And don't forget to use self to turn those functions into methods for the instance, like
def moveup(self): |
Forum: Python Sep 21st, 2009 |
| Replies: 6 Views: 323 Something like that might do. I avoided the use of float() until the end to keep time-stamp and port info from turning into floats:
raw_data = """\
501 0 0.932 0.933 0.931 0.931 0.929 0.933... |
Forum: Python Sep 20th, 2009 |
| Replies: 7 Views: 421 With wxPython code you can give py2exe an XML based manifest to force it to adopt the Windows XP theme. |
Forum: Python Sep 20th, 2009 |
| Replies: 10 Views: 414 To make more sense you should have written your class this way:
class Animal:
def __init__(self, legs):
self.legs = legs
cow = Animal(4)
chicken = Animal(2)
octopus =... |
Forum: Python Sep 20th, 2009 |
| Replies: 7 Views: 503 Now I am curious, did that work for Python26? |