15,194 Topics

Member Avatar for
Member Avatar for TrustyTony

I optimized very carefully program I was producing by producing the main tight loop functions half a dozen times with various implementation styles. Also i considered amount of passing information in call hierarchy in parameters or letting functions to trust proper initialization of the global variables. I got few interesting …

0
115
Member Avatar for shaftoe

Hi, I've had a bit of experience with perl and shell scripting. I've been reading the O'Reilly Python book and have been having a go at replicating some of our perl scripts in python (v3.1.2). I'm looking to put something together than will parse through large xml files and manipulate …

Member Avatar for shaftoe
0
151
Member Avatar for dpswt

Hey guys, I'm new here and my question is what to use (if it exists) and possibly how to simulate a "notebook" where instead of Tabs I would like to do it with buttons (wx.Button). Being more specific, what I would like to do is to make the same functionality …

Member Avatar for dpswt
0
177
Member Avatar for kar0lis

Hi how to kill the[B] recv [/B]or [B]recvfrom [/B]in socket connection, then there is no data and the functions recv, recvfrom is in waiting mode.?for example: [CODE] sock=socket.socket(...) sock.bind((host,port)) while True: packet,address=socket.recvfrom() print packet [/CODE] if there is no data on socket it is waiting, so how to kill it …

Member Avatar for Gribouillis
0
149
Member Avatar for pythonnewbie10

[code=syntax] import random def main(max): print "\tWelcome to 'Guess my number'!" print "\nI'm thinking of a number between 1 and 100." bestoutof = raw_input("Best out of : ") num = random.randrange(101) tries = bestoutof guess = "" while guess != num: guess = int(raw_input("Take a guess: ")) if guess > …

Member Avatar for woooee
0
145
Member Avatar for kar0lis

Hi, I need that my server will be in waiting mode while first packet arrived, when it happens it shoud start to receive packets until the socket.settimeout(1) function kill waiting. my code seems like that, and is working properly until settimeout() return : Traceback (most recent call last): File "C:\Documents …

Member Avatar for kar0lis
0
146
Member Avatar for jituhds

Hi All, I read the document here with the title "Using PHP and Javascript instead of CGI" on link [url]http://python.about.com/od/cgiformswithpython/ss/phpjscgi.htm[/url] can any one elaborate it with an python code say print 10 numbers.I am confused little bit that If I write test.py file for 10 numbers How will I call …

0
29
Member Avatar for bharatk

I have a form in which I can input text through text boxes. How do I make these data go into the db on clicking submit. this is the code of the form in the template. What do I give in form action? [CODE]<form method="post" action="[B]what do I put here??[/B]"> …

Member Avatar for Kruptein
0
161
Member Avatar for teg1989

I'm an extreme beginner with Python (this game is the first time I have ever seen it) so please bear with me. Creating a simple dice game. Place a bet. Three dice are rolled, if any are the same value you lose. If you win, you get double your bet. …

Member Avatar for ~s.o.s~
0
2K
Member Avatar for Witchfairy

This is due within a few hours, and I am unable to spot what is causing the program to not work. Any suggestions? ["""Bounce - is a game that has a ball which increases in speed when you click on the ball. That click signals the ball to speed up, …

Member Avatar for TrustyTony
0
131
Member Avatar for mahela007

I"m trying to make a [URL="en.wikipedia.org/wiki/Sudoku"]sudoku[/URL] puzzle generator (or at least the basics of one) for my project. I'm approaching this by dividing the sudoku grid into 9 rows. Each of the rows will be represented by a list and each list will have 9 elements to represent the nine …

Member Avatar for mahela007
0
359
Member Avatar for ultimatebuster

[CODE] # What exactly is the difference between: class Test: pass # and class Test2(object): pass [/CODE]

Member Avatar for vegaseat
0
78
Member Avatar for SgtMe

Let's say I have this: [CODE] class main: def add(self): print '1 + 2 = 3' [/CODE] I then want to be able to call the add function again from within itself. Like this (BUT THIS DOESNT WORK!!!) [CODE] class main: def add(self): print '1 + 2 = 3' self.add() …

Member Avatar for SgtMe
0
81
Member Avatar for Noliving

When eval an equation does it follow the PEMDAS rules? For example: 2.0-1.0-3.0*6.0+5.0*4.0 when evaluated equals 3.0 when evaluated by python. To me that doesn't seem correct, I get a much larger number than 3.0 When I evaluate in python eval("6/2*3") it should equal 1 but in python it equals …

Member Avatar for Tech B
1
210
Member Avatar for leviaeon

Hello guys, I am implementing this code that will transfer a string from mobile to a bluetooth device. I have already done the extraction of sms from the inbox and then save it as a text file by the way I am using nokia 6600 as a test phone. Then …

0
57
Member Avatar for jonymanolo

I need run a c++ method from my python program but the c++ method need a few parameters what need for call that method in my python code with the paramethers

Member Avatar for vegaseat
0
304
Member Avatar for SoulMazer

Hi, I'm writing a media player with wxPython and I seem to be having a bit of trouble. In my script, I create a wx.media.MediaCtrl widget; this line of code causes the trouble. On my Linux machine (running wxPython 2.8), this line of code causes no trouble at all. However, …

Member Avatar for vegaseat
0
230
Member Avatar for ygarin

Hi everyone! I wrote a Python 2.5 application, with GUI from Tkinter module. To make it short, the user has to load a file and can start to work on it. I made it Windows executable with py2exe, and installable with Inno, with a file association setting. So now, if …

Member Avatar for Gribouillis
0
409
Member Avatar for Hummdis

I'm using Python and the Python CGI module to do some web development for a system's administrative access page. The problem I have is that the current features allow you to reboot the system, power off the system and stop/start/restart system services. The system is very limited in what's running …

Member Avatar for Hummdis
0
375
Member Avatar for kjock002

i'm writing a program that reads the lines of a file. each line has a name and and number separated by one space. i want to split the string but i only want the number because i'm using it in calculations. i've skimmed through the python docs and i'm still …

Member Avatar for TrustyTony
-3
231
Member Avatar for adam321

[CODE][/CODE] def Given(rn): Given_lengths = [0] * 1000000 def rn2(n): if not Given_lengths[n]: Given_lengths[n] = rn(n) return memoized_lengths[n] return rn2 def cycle_length(n): if n == 1: return 1 if n % 2: return cycle_length(n * 3 + 1) + 1 return cycle_length(n / 2) + 1 def problem(i,j): for x …

Member Avatar for jcao219
0
174
Member Avatar for prashanth s j

Hi all, I tried running the following code. [code] #! /usr/local/bin/python import threading import time print "Press any key to start timer!" input() threadBreak = False def TimeProcess(): while not threadBreak: print "How are you?" print (time.time() - startTime) startTime = time.time() threading.Thread(target = TimeProcess).start() input() threadBreak = True input …

Member Avatar for woooee
0
114
Member Avatar for srk619

im looking for a python mud game example which i could see the coding and make my own mud, the thing is that im very new to mud if i was able to see an example of a game working then i would be able to understand what coding classes …

Member Avatar for ultimatebuster
0
794
Member Avatar for spacemandan

For my CS1 class we have to write a simple battleship game. I'm having trouble even knowing where to begin. After I get a basic skeleton of functions and classes I think I will know where to begin. We have to use the Zelle graphics.py module ANY help would be …

Member Avatar for ultimatebuster
0
89
Member Avatar for ShadyTyrant

Well I have reflected on why my first proposal for a open source project failed. We had no base to build on, and there was to much administrivia that made us loose interest in the project. Since then I have come up with a new project idea. I started simple …

0
101
Member Avatar for jcao219

I personally prefer the 3 syntax over 2, but I notice most of the code snippets in this forum are for Python 2. Is it because we are still in a steady transition from 2 to 3, or is it something else?

Member Avatar for hondros
0
207
Member Avatar for basti!

Hey, can somebody help me. I have to do a programm from school. I a complete newbie in python. Can somebody tell me why my programm doesn't work and what i can do. thanks here it is: [CODE]import matplotlib import numpy import pylab lam = pylab.linspace(0.1,100,1000)*10**-6 pylab.xlabel('Wellenlaenge (mM)') pylab.ylabel('Temperatur (T)') …

Member Avatar for woooee
-3
178
Member Avatar for Soren Werk

I'm getting started with Django on Windows. And the tutorial [URL="http://docs.djangoproject.com/en/dev/intro/tutorial01/"]http://docs.djangoproject.com/en/dev/intro/tutorial01/[/URL] has me running "python manage.py <command>" from a command promt all the time. But I'm wondering: Couldn't I run the manage.py commands from PythonWin or IDLE?

Member Avatar for TrustyTony
0
116
Member Avatar for ITgirl2010

[code=syntax] #calculate the amout of tax due to the tax given income def calTax( income ): tax = 0 if income <25000: tax = income * 0.25 elif income > 25000 and income < 50000: tax = 25000 * 0.25 + (income - 25000) * 0.33 elif income > 50000: …

Member Avatar for JasonHippy
0
1K
Member Avatar for gunbuster363

The methods is so complicated. I want to check the execution time of each statement so that I can modify that part in order to increase speed. Thanks in advance, Raymond

Member Avatar for hondros
0
96

The End.