15,406 Topics
![]() | |
can you please tell me the code to make a picture transparent in python.thnx... if possible you give me the codes. thnx in advance | |
How do you compare two decimal numbers in python? | |
Hi, I have a question regard to assign the values to each memebrs of the class objects because I have a large list of class objects. Can I do the following? If not, how can I achieve the same thing? Thanks in advance. class person(): def __init__(self): self.name = ' … | |
I've been trying to use binding to a KeyPress/KeyRelease such that a particular function runs as long as the key is pressed and ceases when it is released. However, it seems like my major problem is that most keys are considered to continually activate as long as you hold them … | |
What and when you would use Decimal vs Float Type? | |
Hello all, In my python application I am trying to capture the output of stdin from a command that I run via popen2(). The python docs say that it returns a tuple of (stdin, stdout) however and i run: [code=python] result = popen2(command)[0].read() [/code] It only prints the results to … | |
I have been trying to figure out how to create a custom save script for text games and a text editor that I am working on. I was thinking I would have to have the script write to the actual program, unless I had an extra file just for saves. … | |
I am trying to learn Python by converting my C++ homework to Python. Below I am converting a Cobol file of employees to a comma delimited file. from: 00001JAMES ADAMSON 010104000014550324201021500067500040010011593 to: ID#,Last,First,Territory#,Office#,Salary,SSN,Department#,JobClass 00001,ADAMSON,JAMES,01,01,40000.00,145503242,01,02 I want to use EOF as my while loop control but I am getting a syntax … | |
I need to find a regular expression in Python. My text string is: 2007-10-12,163.01,167.28,161.80,167.25 I want to extract only the last part: 167.25 (end of line part) I tried using regex="(?=[,].+?(?=[\\n]))" but it did not work. What will be the answer? Thanks! | |
Hello, I have Python 2.4.4 installed on a system (CentOS distribution) at my university. I am experimenting with some python add-ons which are already installed. But the files are with Read-Only permission. Root permission is not my problem. But I want to alter the program code of some python add-ons … | |
I am a new Python user and would like help on the following task. I need a program that will be able to receive input from the system COM port and display it in a window that mimics an LCD graphic display that would be found on a calculator or … | |
Hi, I am very new to Python, I know how to write a basic program, but i know nothing about drawing graphs. I need to write a program to test a random number generator by putting dots on a coordinate graph. Can someone tell me how to make a coordinate … | |
Again I have tried to move on to another program and I am running into another snag. I am trying to write a program that determines if a number is prime. I know the basic format of what I have is pretty close (we talked about it in class), so … | |
Hello EVeryone... I really need some help with this problem... A certain CS professor gives 100 - point quiz graded on scale 90 - 100:A 80 - 89:B 70- 79: C , 60 - 60:D <60 :F I need to write a program that eccepts an exam score as input … | |
Hey all, I'm trying to write a python networking program that is capable of recieving arbitrary files, as well as sending them. However, I can't really get it working, though occasionally a string seems to get through in tact. If someone could look through my code and maybe run it … | |
Hi, my friends, I try to use csv module to input data in csv format but split does not work. Could you please help? The input data is 2 column data separated in comma as csv format. The code is following: reader = csv.reader(open('Indices.csv', 'r'), delimiter = ',') line = … | |
Hi, I created a python script and trying to run it as a windows service. In my script I am reading some data from a configuration file . My problem is , if I run the script in python editor it will work fine and when running the same as … | |
Hi every bod I am new in programming and I like to start with pyqt but I can not find anything for learning in internet please help me how how can I write program with gt designer & when I make a form in qt how can it work(my English … | |
excuse my ignorance, cant find it here in the forum. how do i strip the "|" or the pipe character from a line. i tried this. it splits but doesnt remove the "|" character. output = string.strip (line, '|') # strip the pipe character print output.split() # split output and … | |
Hi, I have a question ask you or expert. Can python's function return a class at the end of function definition. The class have only a set of data members like struct in C. Please help and thanks in advance. Any good reference on this topic? John | |
[COLOR=red]if(ikmo.getObjectType() == 'Folder'): [/COLOR] sReturnURL = 'Present?object=1.11.1234' else: sReturnURL = 'Present?object=%s' % (oid) The above code when executed doesn't go inside the "if" condition despite the condition being true. Can anyone tell me where is the problem??? Editor for Python on Daniweb: Please use the [b][noparse][code=python][/noparse][/b] and [b][noparse][/code][/noparse][/b] tag pair … | |
Hi! Haven't posted on danniweb for awhile, but I'm hoping I can get some help. I am in the middle of learning Java, which will be my second language after python, and I have come across a problem, ordering a list of integers in an array. In python, there's a … | |
Hello! I was wondering if anyone has a forum backend, in java? I know a bit of python myself, but I want the backend (working backend for a forum) I am going to make the frontend myself (in html, not php, has to be html) Please provide it! Thanks in … | |
Hi, I am tryiing to open a file from my python project. The path to the file is given as .\Templates\html\temlate1.html. I used the file Alerter.py to open the above said file. Actually this source file and the Templates directory are existing in the same folder and on execution of … | |
Hi, After trouble shooting error 10061, 1130, 1045 and 1044. Finally, the following code works in a python shell. import MySQLdb import MySQLdb.cursors conn = MySQLdb.connect(host="ENG-3", user = "Any", passwd = "", db = "daily", cursorclass=MySQLdb.cursors.DictCursor) user='root' also works. I now have a small cgi script, the values from the … | |
Hi I’m trying to use the function os.execv to execute a batch script within my Python script. Second argument for os.execv shall be a tuple or a list and I test to send tuple or a list as second argument, but nothing works, I get different type of error message. … | |
Hello! I was wondering if anyone has a forum backend, in python? I know a bit of python myself, but I want the backend (working backend for a forum) I am going to make the frontend myself (in html, not php, has to be html) Please provide it! Thanks in … | |
when i change the state of a entry widget to disabled it greys out automaticly and this doesn't happen with text widgets. I was wondering if there is a specific value i can change for text widgets to make it work the same way as a entry widget. this is … | |
Hello all, I've been having a ton of trouble with this custom gtk dialog I am trying to create. The code "runs" however I receive a GtkWarning message saying: [code] /home/maddog39/Projects/mmoalert/actiondialog.py:42: GtkWarning: gtk_box_pack_end: assertion `child->parent == NULL' failed self.message_hbox.pack_end(self.message_entry) [/code] For the life of me, I can't seem to figure … | |
To get an ascii value of a char we have the ascii(c) function in curses.ascii module... but in the curses module _curses module is imported... which is not there in the library hence exception is being generated... can anyone kindly help.. or suggest any other method for conversion... | |
hi , In python (pygtk) , how can I create a popup window and attach a picture to it. I want to hide window's titlebar and borders. Actually, I want to show only the picture and nothing else. thanks. can you introducing sample? | |
I am trying to use the function cmpfile of the cmp module which returns true or false if filepaths passed are same or not... But the interpreter flashes an error "undefined global name false"... Also it doesnt accept true or false in other functions also.. what might be the problem??? … | |
Hi, my friends, I am new to python. I have a question to ask you a empty class with a set of data memebers. The data members could be array. what is wrong with the following code? Thanks in avvance. # define an empty calss class temp: pass # copy1 … | |
I'm having a problem trying to create a game. the point of the game is to guess a random number. i'm learning python and i tought it would be a good exercise. everything went fine (if you dont count syntax errors :)) until i tried to save the program. i … | |
Greetings, I'm whoiga, and I'm glad to have finally registered here at DaniWeb. I'd been a lurker for quite some time and was always viewing DaniWeb during my busier hours of the day - forgetting to come back and register. I know some PHP (not enough to design something as … ![]() | |
1+1 is 10 in binary and then you carry over the 1. I was wondering how to do that with Python? I was able to invert the binary and determine the sum of the rightmost bit and if it's 2, the rightmost digit would become 0. This is where I'm … | |
Hi, Ny friends, This is my 2nd week to learn and wite codes in python. I encounter a debug error in the last line of code or SizeDiffE(k) = j . I could not figure out? I am using SPE IDE 0.8.3 to debug. for k in range(1, NoE): for … | |
Hi, Could u please help me to sort this 3 dimension data in python? How can sort this 5 by 3 array with 1st column or last column? Thanks a lot. marek brutalski 20 zenia markownikowa 10 teresa parufkowa 90 bogumila pierdawa 40 genowefa tempawa 50 John | |
Hi, I am newie to python. How I combine 2 multi-dimension array into one by column? here is an exmaple: a = 1 2 3 2 3 4 3 4 5 b = 4 5 6 6 7 8 8 9 1 the combined array should be c = 1 … | |
Why can't you do this? [code=python] a = [] a.append('1').append('2') [/code] You can only do this: [code=python] a.append('1') a.append('2') [/code] | |
Hallo all, Ive got 10 strings of data that i plot into 1 big window, but somehow matplotlib gives me a very strange set-up. I am rather new to matplotlib and python so im kinda stuck now! heres an image of what i get and part of my code: [URL=http://img208.imageshack.us/my.php?image=bildschirmphoto1wh9.png][IMG]http://img208.imageshack.us/img208/8711/bildschirmphoto1wh9.th.png[/IMG][/URL] … | |
I'm trying to convert decimal to binary and I'm having a lot of trouble (new to python). I was wondering why that won't work. Thanks. EDIT: Argh, I'm so sorry but I got it fixed. It turns out that the assigned variables are on the wrong side. | |
I am looking at this recipe: [url]http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440509[/url] When I tried to do it, doesn't work. why? [CODE]>>> from sets import Set >>> new_list = [2,34,5,5,6,6,7,2] >>> print new_list [2, 34, 5, 5, 6, 6, 7, 2] >>> new_list = Set(new_list).elems Traceback (most recent call last): File "<interactive input>", line 1, … | |
I've always wondered how can I work with this. Suppose I want to create a for loop that prints "Hello!" from 0 to 50 for example. I know I can use a while loop for it, but that's not how I want it to work. Say k = 0, total … | |
Hi, My friends, I am new to python. I try to figure out how python knows the end of loop or the end of a block of codes in while... else code Here is the example: while E: Bt else: Bf here if Bf have 20 lines of code. How … | |
what is %r mean? [code=python] "%r tag requires exactly two arguments" % token.contents.split()[0] [/code] | |
Is there a way to limit size of a list in Python, so it does not use all memory? | |
Hi, my friends, I am new to python. I am trying to user csv module to read and write the data in csv. Here is data format. # of columns in each row are the same. 1st row is a header. how I can pass the data into 2-D array? … | |
Can someone tell me what is the different between default_age and self.default_age? Only one default_age variable is created for all instance of class Student and self.default_age means very instances of class Student gets a variable default_age? How do you specify a static class(singleton class) in python? [code=python] class Student: default_age … | |
hello i'm new here but i have made a little python calculator and was wondering, if i wanted to give a copy to my friend how would i change it from a python file to a umm .zip(just an example) file where my friend can just unzip it and use … |
The End.