15,181 Topics
| |
[CODE]# PURPOSE: to see if a user entered number (n) is prime or not prime # # INPUT(S): a number greater than 2. (n>2) # # OUTPUT(S): prime or not prime depending on what (n) is. # # EXAMPLES:input: ;output: # input: ;output: ################################################################################ import math def prime(n): for i … | |
Hi, I am hosting a UDP server as part of my application on a thread. The problem is when I close the application it doesn't exit completely because the server is still running on the thread. [code=python] class pdu_parser(Thread): run_parser = True sock = None def __init__(self): Thread.__init__(self) def run(self): … | |
Hi All, I have a popup window, which shows up after double clicking an installer. This window has 3 buttons: Back, Next & cancel. Using win32api I am able to get the window handles for all three buttons. I need to find out which of the buttons is enabled or … | |
hey, im having trouble making a python program run using a window, honestly i dont even know where to start. I have to make a coffee program where there is a menu and the user has to choose between adding, modifying, searching, showing, and deleting any entrys made to the … | |
Hi, I'm trying to use the built in gcd method to calculate the gcd for two values. Unfortunately I can't seem to import the right module to get the method. [code=python] from fractions import Fraction ... x = gcd(a,b) [/code] | |
I'm trying to code the game of minesweeper. For some reason, the image won't display properly--and it isn't a case of a missing file, b/c I have a try-except code snippet that is set to print out an error message should this occur, and that isn't happening. So either it's … | |
Hi I've been give a task to create a text based game (multi user dungeon) in python but am unsure where to start. All I know is I have to use tcp and udp or something like that. I am very unfamiliar with this so I hope someone can help … | |
Hi everybody, I'm new at Python and this forum has been a great help so far, so I hope someone is willing to help me on the following problem. It can count the number of sentences and words in a text, but after I have split up a text into … | |
I have a wx app that I would like to actively debug (even after it is compiled via py2exe). Is there a way to hook all methods(without having to manually add code to each one) and have it print their names' as they execute. I've looked into both the "inspect" … | |
[CODE=python ]while 1: tracking.update() for obj in tracking.objects(): allobjs=[] allobjs.append(obj.xpos) allobjs.append(obj.ypos) allobjs.append(obj.xmot) allobjs.append(obj.ymot) allobjs.append(obj.sessionid) aobjlist.append(allobjs) [/CODE] In the above snippet of code tracking.objects() returns a list of objects with above mentioned properties. tracking.update() continuously updates obj attributes and adds new objects. Our requirement was to have an Multi dimensional list … | |
Hi, I was wondering if there was a way to set a directory in python code when I read/write files. For example, if I have [CODE] import scipy def test_io(): scipyArray1 = scipy.array([[1.0,2.0],[3.0,4.0],[5.0,6.0]]) outFile = file('tmpdata1.txt', 'w') scipy.io.write_array(outFile,scipyArray1) outFile.close() inFile = file('tmpdata1.txt', 'r') scipyArray2 = scipy.io.read_array(inFile) print 'type(scipyArray2):', type(scipyArray2) print … | |
Hi people! I need your help with a find function for a glossary program that I'm writing for my own use. I'm using python 3.x and have already made a find function, but I don't like how it came out. Let me explain with an example: First, let me show … | |
the question is: "Sum of a series of numbers entered by the user until the value 999 is entered but 999 should not be a part of the sum" at first i thought the question was asking for the sum of user entered numbers until the sum reaches 999. after … | |
[CODE]# PURPOSE: to calculate the sum of the first (n) odd counting numbers # # INPUT(S): the number (n) which will be the last number added to the sum # # OUTPUT(S): the sum of the first (n) counting numbers # # EXAMPLES: input: 23 ; output: 144 # input: … | |
Hello, it is me again with another homework assignment. I am having issues starting this one. Every draft I make for it feels way too long and that I can make it much, much shorter. First, I am using Python version 2.3.2. I am using graphics.py, buttons.py, and am basing … | |
The title maybe a little bit confusing, I will explain it. I am using opensuse. Usually I work in a shell like this: $vim test.py $python test.py >>>running... >>>running... >>>running... >>>running... $ Here the program end, but I cannot make further change nor access to the variable. I know I … | |
Hey whats up I'm new to this forum so I hope I'm posting this right. Ok so my problem is that I have created a server in python that is on a certain port, and I have setup port forwarding so that all traffic on the specified port is sent … | |
(a) [CODE]def main(): maze= open('maze.txt','r+') for line in maze: line = line.strip() print line maze.close() print start(maze,x,y) print maze[y][x][/CODE] (b) [CODE]def start(maze,x,y): for x in range(0,len(maze)): if maze[y][x] == "s" print maze[y][x] return x, y[/CODE] question (b): write a function that walks through the maze and attempts to find exit. … | |
Thanks to another post of mine, I found out about itertools.product(). What I was wondering how to do is to code it so that I can use as many arrays as parameters as possible, with the number of arrays being defined by user input. for example, If the user inputted … | |
I know how to get a program to read a raw text file that has been piped to it, and do some simple things like counting letters, but I don't know how to read the actual words and store the entire word as a string. For example, if a text … | |
Let's take this: [CODE]f = open ('myflie.txt', 'w') f.write ('12345');[/CODE] I always get the length of the output printed on the console. Is there any way to prevent it from printing it? | |
I have addressed this problem sometime ago; I have either misplaced, misunderstood, or never received a response to this issue so therefore I am again attempting to deal with a Python issue: I am towards the end of a build, and I am dealing with button commands, something that was … | |
Hello Everyone, I am an intermediate developer in programming languages. I have developed some python script and some java applications. In my project, I need to integrate the python script with a java application to put all the tools in a single pipeline to function as a continuous workflow. This … | |
I need a way to get all the possible combonations of two lists. I looked into map(), but it only loops through the first array. I tried to do a map function inside a map function, but I couldnt figure out how. Heres an example: [CODE]>>> a=[1,2] >>> b=[3,4] >>> … | |
Dear help I am struggling to figure out why the following sorting algorithm doesn't work. Please help if you can. :) >> #myList is a list of arbitrary length for i in range (len(myList)): for j in range (i, len(myList) - 1): if myList[i] < myList[j]: myList[i], myList[j] = myList[j], … | |
I am working with a keyloger procedure to capture user inputs even mouse has no focus on my app windows. I make it work using that code, the problem is that [CODE] event = handle.read(6)[/CODE] only reports clicks when buffer is full. Its not working ok because there is a … | |
[CODE] # PURPOSE: to calculate the sum of the first (n) counting numbers # # INPUT(S): the number (n) which will be the last number added to the sum # # OUTPUT(S): the sum of the first (n) counting numbers # # EXAMPLES: input: 4 ; output: 10 # input: … | |
I new to Python and I'm trying to make this script work, I made this in php, but I'd like to know how to do it in python... I'm trying to encode a file with base64 and then decode and write the binary data to a file. [CODE=Python]import base64 binaryfile … | |
Hi, all. Just been asked to help design a motion rig for a flight sim for a charitable museum in the UK. I have built robotic and control systems for a few years now mainly with PLC's some python and PICs. they are running Microsoft FS2004, and there is a … | |
Hi, I am new to python but I want to use it over perl because I think it is a better overall approach to programming. This is a bioinformatics problem. I have four identically formatted tab delimeted files that have genomic variation data. Each line looks like this. chr1 11828655 … |
The End.