15,175 Topics
| |
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 … | |
Hi, I have a dictionary storing many things... I would like to delete entries which have key of len < 3. But after I do the del statement, there are still lots of entries with len < 3, what happens? [CODE]for w in fdict.keys()[:]: if w.strip() in banset or len(w.strip()) … | |
How to start a new thread?Sorry am a new bee here. | |
Please help I'm having trouble getting my program to return any answer other than "You Lose!". Where is my mistake? Thanks in advance for any help. [code] print "Let's Play Rock, Paper, Scissors!!" print "Rock beats scissors, paper beats rock, and scissors beats rock and paper! Have fun!" import random … | |
hi guys can anyone explain to me this code. i dont really get this. thanks a lot. def readFile(name = ""): try: assert (name != "") , "The file name is not given!!" except AssertionError: print "file name is not given" else: try: f = open(name, 'r') except: print 'File … | |
How to fill array with any no like using zeros and ones. i'm new to python and i can't find the answer.... | |
Write a python function to convert a numeric input argument to a string output based on the following rules: >=10: A, 9:B, 8:C, 7:D, 6:E, <=5: F I came up with this, but it does not work at all table = {'A': 10, 'B': 9, 'C': 8, 'D': 7, 'E': … |
The End.