Forum: Python 11 Hours Ago |
| Replies: 7 Views: 5,902 You should really start a new thread of your own!
The string function find() can find a subtext within a larger text, as will re.findall(). The advantage of find() is that it will give you the... |
Forum: Python 11 Hours Ago |
| Replies: 3 Views: 111 For homework problems please give help in the form of hints, not total solutions or the OP will not learn anything. |
Forum: Python 11 Hours Ago |
| Replies: 7 Views: 76 In that case I really don't have enough information of what you have and what you did with it! |
Forum: Python 12 Hours Ago |
| Replies: 7 Views: 76 For a wx.TextCtrl() instance I simply use the WriteText() method. |
Forum: Python 12 Hours Ago |
| Replies: 9 Views: 257 Thanks for the info and the works. I haven't had time to check the limits of that program. Since Python handles extremely large integers, I imagine computer memory will be the limit again. |
Forum: Python 12 Hours Ago |
| Replies: 8 Views: 105 Nice effort!
My comment, I see you are still using tabs for indentations. Avoid them and use 4 spaces as most other folks. If you use tabs, you sooner or later will mix them with spaces, then... |
Forum: Python 12 Hours Ago |
| Replies: 2 Views: 67 I usually whip up a little test program. Here you use the length of your columns list to avoid problems ...
# possible test data
data = """\
a,z,1
b,y
c,x,1
d,w,1
e,v
f,u""" |
Forum: Python 13 Hours Ago |
| Replies: 1 Views: 62 Take a looky at something like this ...
data = """\
------------------------------------ ----------- --------- ------------------------------------ -----------------------------
-------
PRODUCT... |
Forum: Python 1 Day Ago |
| Replies: 8 Views: 142 Thanks for making people aware of the pylint tool. It's been a while since I used it on my own code. :) |
Forum: Python 1 Day Ago |
| Replies: 9 Views: 257 To get very large prime numbers without causing memory problems, you indeed have to apply a range to keep the list relative short, like this example shows ...
# prevents the list of primes from... |
Forum: Python 1 Day Ago |
| Replies: 8 Views: 142 I would also say that your code suffers from excessively long variable names. Try to keep each code line's total length somewhat less then 70.
Then there is ziggy and a 2 caught between (( etc.... |
Forum: Python 1 Day Ago |
| Replies: 9 Views: 122 I hope you have luck finding someone who actually uses pygtk. I run on a Windows platform and pygtk is a bear to install. |
Forum: Python 1 Day Ago |
| Replies: 4 Views: 107 There is an even more specific string function ....
n = 2
digits = 3
ns = str(n).zfill(digits)
print(ns) # 002
These string functions work with Python2 and Python3.
Gribouillis, thanks for... |
Forum: Python 1 Day Ago |
| Replies: 6 Views: 135 One eye would make it simpler ...
from graphics import *
def drawCircle(win, centre, radius, colour):
circle = Circle(centre, radius)
circle.setFill(colour)
circle.setWidth(2)
... |
Forum: Python 1 Day Ago |
| Replies: 6 Views: 114 This problem really asks for the use of a dictionary object ...
# typical test data
data = """\
1 20
2 56
3 42
4 53
5 90
6 33
""" |
Forum: Python 1 Day Ago |
| Replies: 11 Views: 287 That means that the startup code from Gribouillis could also be written this way ...
# mystartup.py
import sys
from distutils.sysconfig import get_python_lib
sys.path.append(get_python_lib())... |
Forum: Geeks' Lounge 1 Day Ago |
| Replies: 667 Views: 73,194 That thing looks like it ought to tip over any minute now! I still would not sail it amongst the icebergs. |
Forum: Geeks' Lounge 1 Day Ago |
| Replies: 1,361 Views: 143,061 A hot bowl of chicken noodle soup and crackers. |
Forum: Python 1 Day Ago |
| Replies: 6 Views: 135 One way would be to say that the center should be at 1/2 width and height of the drawing window ...
from graphics import *
def drawCircle(win, centre, radius, colour):
circle =... |
Forum: Python 1 Day Ago |
| Replies: 3 Views: 97 jaison2, range(drawBlock) in your code does not make any sense, since range() expects an integer value. In your loop you want something like this ...
for row in range(height):
# multiplier... |
Forum: Python 1 Day Ago |
| Replies: 4 Views: 107 You can use one of the built-in string functions ...
n = 2
digits = 3
ns = str(n).rjust(digits, '0')
print(ns) # 002 |
Forum: Python 2 Days Ago |
| Replies: 5 Views: 156 Thanks for the info, hope it works for the OP. I have been sitting out Vista successfully so far, and probably will never have the pleasure to try this out. Eventually I will have to bite the... |
Forum: Python 2 Days Ago |
| Replies: 6 Views: 135 One eye has to be positioned center_left, the other center_right ...
from graphics import *
import math
def drawCircle(win, centre, radius, colour):
circle = Circle(centre, radius)
... |
Forum: Python 2 Days Ago |
| Replies: 5 Views: 116 Wow, I would have never guessed that from your original question.
Hint, variable names starting with a capital letter are by convention used for class names. |
Forum: Python 2 Days Ago |
| Replies: 1 Views: 66 Remove all the silly os.system("clear"), they are not needed and work on one specific OS only, then it will work ...
#Credits:
#Nevets04
#Fallen
#Uber1337
#Farout
#import os
List = []
z =... |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 68 Views: 8,564 Q: "Why don't you ever see lawyers at the beach?"
A: "Cats keep covering them with sand." |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 667 Views: 73,194 Three thousand men labored for 2 years to complete the largest man made moving object in the world. Each of Titanic's engines were the size of a 3 story house. She weighed 66,000 tons and was... |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 41 Views: 1,017 I think that you are forgetting the almost obligatory anti-virus software you need for Vista. Now the Vista boot up time is about 5 minutes. |
Forum: Geeks' Lounge 2 Days Ago |
| Replies: 13 Views: 553 Computers are a commodity item and disk space to a large part is marketing hype for the masses. It's just like cars with all that extra horse power. |
Forum: Python 2 Days Ago |
| Replies: 4 Views: 111 If you are brave enough to ask questions, then you are not silly! |
Forum: Python 2 Days Ago |
| Replies: 5 Views: 156 I have read that Vista has a nasty habit not to install certain files because of its childish security concerns, and it won't let the user know about it.
My advice, get rid of Vista as soon as you... |
Forum: Python 2 Days Ago |
| Replies: 8 Views: 142 I think you should learn Lisp to get familiar with parenthesis.
Yes, you are using too many of those in your Python code. You can study up in the precedence of mathematical operations to remove a... |
Forum: Python 2 Days Ago |
| Replies: 9 Views: 168 LF and CR are actually printable.
This little code will give you a list of printable characters ...
import string
print( list(string.printable) ) |
Forum: Python 2 Days Ago |
| Replies: 9 Views: 162 I want to encourage posters to give us the version of Python they are using. Otherwise the rest of us have to assume and ask. Python25 for instance allows you to use the print statement or the... |
Forum: Python 2 Days Ago |
| Replies: 13 Views: 220 This Python code shows you how to pick a random number from a list ...
# picking random numbers from a list
# Python2 syntax
def pick_rand(rand_list, start=-1, incr=1):
"""
closure... |
Forum: Python 2 Days Ago |
| Replies: 9 Views: 168 If you read a binary as a text file (mode='r'), you have to be aware that the binary data can inadvertently contain an EOF (End Of File) marker early on, at which point the read would stop. Using a... |
Forum: Python 3 Days Ago |
| Replies: 4 Views: 111 Take a look at the final lines of this code snippet:
http://www.daniweb.com/code/snippet216747.html |
Forum: Python 3 Days Ago |
| Replies: 5 Views: 156 I assume you used the Windows installer
VPython-Win-Py2.6-5.12.exe
not quite sure if that needs numpy too. I don't use Python26.
The example works very well with Python25. |
Forum: Python 3 Days Ago |
| Replies: 13 Views: 220 A time based random number generator will only work if called once, or uses the random time between a user input event.
The function time.time() only updates 18.2 times per second, too slow if you... |
Forum: Python 3 Days Ago |
| Replies: 3 Views: 8,188 @kisan:
in essence line 10 and 12 contain all of this |