14,946 Topics

Member Avatar for
Member Avatar for MakingMoney

I'm trying to give python a list of numbers like this (5 6 7) and I want it to square each number (or as many numbers as I input). I'm trying out a list comprehension on this. I'm not sure where I'm going wrong. Any help would be great. [code="Python"] …

Member Avatar for jrcagle
0
324
Member Avatar for muddpigeon

ok so heres the thing, ive got to to do this program for college but the lecturer is a numpty and wont help anyone. so im stuck. ive only got so far into the program and cant get the most important bit to work where it is supposed to. its …

Member Avatar for jrcagle
0
529
Member Avatar for renochew

Hi, this is my first post here. And I am new to python. I have script which supposed to read in a series of files in the format "myfile.*.obj" where "*" is a sequential no. (001,002...) but when I run the script, it seems that it have difficulty recognizing the …

Member Avatar for jrcagle
0
119
Member Avatar for remmoc

hey ive been working on a txt game... btw im using python 2.3. i am trying to have a requirement for each 'room' or function, i want it so the user has to pick up an object into their inventory before they can go on to the next room. here …

Member Avatar for Ene Uran
0
69
Member Avatar for MakingMoney

So I've written a code to get an acronym of the phrase inputed by the user. The only problem is that it insert an extra line in the result which I don't need. I'm not sure what is causing it. Here is the code and the results: import string def …

Member Avatar for MakingMoney
0
268
Member Avatar for thompsongunner

I'm trying to get a grasp of inheritance in Python but am having problems. I am trying to create a derived class but want the derived class to only provide an initialized instance of the base class. Specifically I would like to inherit from [inlinecode]OrderedDict[/inlinecode] as shown in the following …

Member Avatar for jrcagle
0
188
Member Avatar for pompeez

Hi, I have made a parser in python (using Dparser). I have stored the parsed syntax tree in a dictionary. Now, i want to draw a tree to display the tree. I found out that you can use svg.py in Imagemagick to draw such a tree. But, I have no …

0
43
Member Avatar for jrcagle

I'm writing a lesson on debugging for my students. They will have already had a lesson on how to read code and do walkthroughs, either manually or using the debugger. They currently know about [B]if[/B], [B]while[/B], types, math operators, and have some experience with but no formal training in functions …

Member Avatar for jrcagle
0
96
Member Avatar for MrShoot

Hi, this is my first forum message so I'll make a brief introduction. I'm from Canada and I am Computer Science student. I enjoy working with computers, specially web programming. It has come to my attention (and also a school requirement) to learn Python. So here I am with my …

Member Avatar for Ene Uran
0
158
Member Avatar for Yee

HI! I have a problem: I want to initalize a class by a condition. For example: [CODE] class something: def __init__(self,a): self.a = a if self.a == 0: #break initalization else: #continue initalization [/CODE] How do I break the initalization? Thank u and sorry for my english!

Member Avatar for Yee
0
179
Member Avatar for Eclipse77

Hi everyone, I'm new here and I'm looking forward to seeing how everyone codes in python. I'm a complete newbie, who has never done any programming in his whole life (except for the past 2 week). I read the guidelines about asking for help on assignments, and I wouldn't have …

Member Avatar for jrcagle
0
171
Member Avatar for City one

Hi, Once I press S(to start), I would like to make only one IP (that I entered manually) to be ping each 60 secondes, and print Hello at each second or 2(whatever) and If I press Q, than it`s stop. Can somebody provide me a syntaxe that can help me …

Member Avatar for StrikerX11
0
57
Member Avatar for slunk

I began to learn about Python perhaps an hour or two ago. In a Python tutorial, I came across the below text (between lines of equal signs) regarding default function arguments. This makes no sense to me at all. What is the scope and lifetime of L? It appears that …

Member Avatar for jrcagle
0
710
Member Avatar for tesak

Hello, I am a newbie in Python and maybe this is a stupid question, but when I run this code I receive a very strange output. [code] status = 0 for i in range(10): status = status + 0.1 if status == 0.1: print status elif status == 0.2: print …

Member Avatar for jrcagle
0
101
Member Avatar for Roadphantom13

Hey everyone. Noob poster here so bear with me. So the code below makes a drawing of a face move around the graphics window. However, the face is noseless. My dilema is that I absolutely can't figure out how to add a nose to the face and have it move …

Member Avatar for vegaseat
0
140
Member Avatar for Jusa

Hi, I'm having trouble removing objects from a list. It seems that when I remove single objects in a loop, the loop kind of skips elements in the list, not continuing from the point where the last removal occurred. I want to remove only certain elements from a list, and …

Member Avatar for pandu22
0
513
Member Avatar for dt2611

Hey guys trying to compile code, and heres the error I receive. im fairly new to python programming so any help would be appreciated. thanks in advance. ms7538@ms:~/Desktop$ ./test.py Traceback (most recent call last): File "./test.py", line 10, in <module> class Panel1(wx.Panel): File "./test.py", line 22, in Panel1 bmp = …

Member Avatar for bumsfeld
0
79
Member Avatar for ndoe
0
62
Member Avatar for holsonjr

I am beating my head against an python, cygwin, windows problem that I can not resolve. The script is executing os.system(command) which is OK but os.system is executing in an "sh" shell. I have cygwin installed on my system but I just want the commands executed in a cmd environment. …

0
62
Member Avatar for ndoe

hello all,i hope you all can help for this,i want showing image by clicking button,i have 5 button with parents panel 1 and i want show image to panel 2,my plan the image can be drag or rezise and image show all the time user want,i have idea for drag …

Member Avatar for vegaseat
0
216
Member Avatar for sayanriju

Hello People! I'm trying to design a text editor using wxpython. I wish to add some basic formatting functionality (like BOLD, ITALICS, UNDERLINE) to it. Is there any way to achieve this in wx.TextCtrl ? Or do I have to use stc.StyledTextCtrl (which I don't really wish right now)? Thank …

Member Avatar for vegaseat
0
1K
Member Avatar for Daveshome

Hello. I have been finding more and more databases that output in XML. (Getting more popular all the time I guess!) I am building a script that will take this apart so I can edit items and put it back together in XML format and .cvs format. (to feed to …

Member Avatar for Daveshome
0
89
Member Avatar for dcleaner

i've been playing around with python for some time now, and i decided to take vegaseat's advice to make a project of mine own. the project consist of transforming an access database to xml, and then from xml generate some html files. i exported one table, made some basic modifications …

Member Avatar for dcleaner
0
170
Member Avatar for RaDeuX

So I've been trying to make a VERY simple calculator program, but I tried so many things, and all of my methods failed. I've been at this for weeks, and I'm pretty frustrated up to this point. Nothing calls back on the entry box correctly, and although at certain points …

Member Avatar for vegaseat
0
422
Member Avatar for Jon Pierce

I found this very nice tutorial on what Python generators are and how they can be used: [url]http://www.neotitans.com/resources/python-generators-tutorial.html[/url] I had a difficult time with the other tutorials out there because, funnily enough, they seem to assume that you already know what generators are before they try to teach you about …

Member Avatar for vegaseat
0
146
Member Avatar for jobs

[code=python] s1 ='999' s2 = '99.99' mypat = re.compile('(^([0-9]+[.]+[0-9]+)|([0-9])$)') rate= mypat.search(s1) print rate.group() >>> print rate.groups() ('9', None, '9') >>> rate=mypat.search(s2) >>> print rate.group() 99.99 [/code] I need to get price = float(rate.group()). Price=999 or Price=99.99. I think there is a problem when s1='999', when I do this: [code=python] >>> …

Member Avatar for ghostdog74
0
104
Member Avatar for axn

i know how to create a dictionary but how do i search for a pattern in a file and then create a dictionary based on the search

Member Avatar for ghostdog74
0
114
Member Avatar for Bmarkusrowe

I'm pretty new to the python programming and I am currently trying to create a factorial function which I have, but now I an trying to get it to list the positive integer n as input and then computes and outputs, in separate lines, 1!, 2!, 3!, ..., (n-1)!, n! …

Member Avatar for bumsfeld
0
72
Member Avatar for Raulito

hi guys i have a proble to solve but i do not have a clue what the problem is asking me to do i need some help. i allready know this that a fibonacci sequence i generated by the fuction Fn=fn-1+Fn-2 but the problem says that i need to to …

Member Avatar for woooee
0
106
Member Avatar for jobs

Why you specify type and name of the exception in your custom exceptions, but not in python built in exceptions? except IOError: print "no file by the name ccy_rates*.txt" except MyError, e: print e.msg

Member Avatar for bumsfeld
0
79

The End.