15,175 Topics

Member Avatar for
Member Avatar for snake03

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 …

Member Avatar for ultimatebuster
0
280
Member Avatar for Felulah

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 …

Member Avatar for Felulah
0
2K
Member Avatar for ihatehippies

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" …

Member Avatar for Gribouillis
0
349
Member Avatar for adarshcu

[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 …

Member Avatar for adarshcu
0
200
Member Avatar for daemion

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 …

Member Avatar for vegaseat
0
156
Member Avatar for G_S

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 …

0
277
Member Avatar for kjock002

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 …

Member Avatar for craig_ka
0
72
Member Avatar for kjock002

[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: …

Member Avatar for The_Kernel
0
3K
Member Avatar for tkpanther

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 …

Member Avatar for tkpanther
0
168
Member Avatar for gunbuster363

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 …

Member Avatar for gunbuster363
0
116
Member Avatar for cairn1

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 …

0
73
Member Avatar for adam321

(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. …

Member Avatar for adam321
-2
197
Member Avatar for mattloto

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 …

Member Avatar for vegaseat
0
1K
Member Avatar for wutwutwut

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 …

Member Avatar for vegaseat
0
190
Member Avatar for n.utiu

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?

Member Avatar for n.utiu
0
81
Member Avatar for mattyd

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 …

Member Avatar for TrustyTony
0
374
Member Avatar for systemsbiology

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 …

Member Avatar for ~s.o.s~
0
972
Member Avatar for mattloto

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] >>> …

Member Avatar for mattloto
0
251
Member Avatar for Siyabonga Gama

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], …

Member Avatar for woooee
0
76
Member Avatar for andreski

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 …

Member Avatar for andreski
0
299
Member Avatar for kjock002

[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: …

Member Avatar for Gribouillis
0
113
Member Avatar for X-Boy

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 …

Member Avatar for bumsfeld
0
4K
Member Avatar for vikingsraven

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 …

0
27
Member Avatar for biomed

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 …

Member Avatar for Gribouillis
0
95
Member Avatar for gunbuster363

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()) …

Member Avatar for gunbuster363
0
80
Member Avatar for kunal_00731
Member Avatar for pjistaz

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 …

Member Avatar for SgtMe
0
98
Member Avatar for jjrrmm

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 …

Member Avatar for SgtMe
-2
96
Member Avatar for rhoit

How to fill array with any no like using zeros and ones. i'm new to python and i can't find the answer....

Member Avatar for rhoit
0
89
Member Avatar for the_mia_team

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': …

Member Avatar for the_mia_team
0
123

The End.