15,406 Topics
![]() | |
Why can't I have two different link objects? I create _link and _link2 as empty objects. When I do this: _link2 = _link, it just creates alias _link2 to link object. Same object have 2 aliases _link2 and _link. Is there a way to copy the content of _link to … | |
I'm having problems with storing a wxDateTime object from a wxDatePickerCtrl in a file and then reading it again when the program starts (so I can set the date picker's value to what it was the last time the program was run). When I get the value from the date … | |
Hi There, I have just started Programming in PHP and Python. i have target 30-60 days to launch myself as free lancher. | |
I created a function that creates smiley faces. I want to print more than 1 (with different size and location) on 1 window. How do I do it? Here is the code: [code=Python] from graphics import * def main(): print drawface(Point(40, 40), 20, GraphWin) print drawface(Point(90, 90), 30, GraphWin) print … | |
Hi all, I see a lot of books teaching beginning Python students to code like this: [code="Python"] def func1(): ... def func2(): ... class Blah(object): ... def main(): ... main() [/code] It strikes me that having people "def main():" and then call main() is a bit silly. In fact, it … | |
Hi, i am having trouble with the While Loop for my homework, I am suppose to write a program that says you owe someone money and then with the beginning balance, interest rate and monthly payment entered, I am suppose to use the While Loop to make sure that the … | |
Hello, I am new to python. I have been trying to connect to telnet and feed some data from a server. Its working properly. I used the connectionObj.read_until() method to read the data from the server and made the connection as [code] self.conn = telnetlib.Telnet(so.telnetHost, so.telnetPort)[/code] thats too fine. But … | |
hi all, i would like to know the all possible command line options of GGCOV tool... ex:1. ggcov program name 2.ggcov -o dir if anyone of you know this,plz send me the details... Thanks in advance..... RajasekharReddy.B | |
Hey. any help wud be greatly appreciated. I have just tranferred into the second year of a multimedia course in which they have been doing python programmes. Problem is i have never programmed anything before and have been asked to complete this assignment.:( i dont even know what it is … | |
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"] … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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! | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
Hi Everyone, I am in a class on Biocomputing and we have a project due VERY soon. In part of it, we have to write a script and this is what we have to do: It can execute in the shell, python, or perl. The script should do the following … | |
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 … | |
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 = … | |
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. … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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] >>> … | |
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 | |
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! … | |
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 … | |
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 | |
Hi, I've been programming for, err, awhile now. My experience has been working at Amdahl where I was writing mainframe microcode in IBM assembler and C, and then writing an architectural emulator written in C. I then worked at IBM writing mainframe microcode in IBM assembler. Lastly, I was working … | |
I am trying to use BeautifulSoup: soup = BeautifulSoup(page) td_tags = soup.findAll('td') i=0 for td in td_tags: i = i+1 print "td: ", td # re.search('[0-9]*\.[0-9]*', td) price = re.compile('[0-9]*\.[0-9]*').search(td) I am getting an error: price= re.compile('[0-9]*\.[0-9]*').search(td) TypeError: expected string or buffer | |
My name's Seth and I'm an IT student at the University of Cincinnati. Currently I'm interested in learning more about Ruby on Rails. I'm also looking for anyone who wants to collaborate on any projects just to learn more. I do have some experience in Java, Python and some Ruby. | |
Hi I am new to the forums and to Python! I am having trouble displaying a text menu in the following format 1: Name 2: Name 3: Name It displays it correctly but then it gives an error message: Below is the code with output and error message. #CreateMenu.py #Create … | |
Can anyone help me anything related to --- how to draw 3D objects like sphere, cone, arrow, ring etc. I am new to python but know the basic language. Thanx, Anjali | |
I am developing an application that will run on a PDA and it requires some special layouts and looks for the widgets. The PDA has a touch sensitive screen and the application is used by pressing on the display with the finger tips. Because of this I need to make … | |
Currently I have a list that I have read from a file and it looks similar to... file = [S,D,S,D,S,D,N,S,D,S,D,N] What I was wondering is there a way to loop through the list so that I get multiple lists. For Example.... List1 = [S,D,S,D,S,D,N] List2 = [S,D,S,D,N] If someone could … | |
Hi, (by the way, this site is one of the best forum (display) I 've seen). I have a big issue I would like to resolve, let me explain; I have built a script where I can put IPs into a list and then once I press 0, this list … | |
I am trying to use the bit fields in a useful way to create packed fields that can be sent out as packets. Let's see if my code can help explain: [code] from ctypes import * class myPacketHeader(Structure): _pack_ = 1 _fields_ = [("seqnum", c_ubyte, 8), ("is_command", c_uint, 1), ("address", … | |
ok, I have a list of numbers and i want to return values in a range that are not in the list of numbers... I'm thinking of something like this: [ number for number in range(1, 10) if != nums ] However, This always prints all the numbers in that … |
The End.