15,181 Topics
| |
Okay python gurus, this one has me stumped. Is it possible to introspect and obtain the instance of a class that assigned a class? I have a simple sample that demonstrates what I'm looking for, but doesn't make any sense why you would do it. [code=python] class One(object): def print_parent_hw(self): … | |
Hi, Iam now using Mandriva from external HDD and want to install my development tools. I need to install wxPython, Matplotlib, and some other packages. How to do that in Mandriva? | |
This is an update of an earlier version. In this version the string containing the approximated pi value is created directly from the iteration of the generator. This way the program is simplified and can be used with Python2 and Python3 ... | |
I am trying to develop a function for my application which would use already opened file (fin) and read certain line from it. Each line in the text starting from given keywords (pos1). Finally this function should return a print of all line containing the keywords pos1. But apparently "linecache" … | |
Hi All, I am very new to python Gui programming and am trying to create a simple Gui which will get a set of results from an sql query which goes into Oracle and display these results in the text box below. If u can also help me get the … | |
In the following program, why do I need to use the name "player" rather than a regular counter like "i"? I ran the program this way and it prints out the last element in players for how ever many player elements are in players. I want to know what's going … | |
the code on my localhost and on the server are completely the same (django), but it is not shown correctly; I include two screenshots What could be the cause of the difference? (the left one is the online server; the right one is the localhost) | |
How to convert dd-mmm-yyyy (01-Jan-2009) to dd/mm/yy (01/01/09) using python functions. | |
what can i get from object.attribute? what does it do? Thank you :) | |
hello Seniors, i am new to python development.i have started my internship in that language. can any one provide me the code that show me how to add subtract and multiply matrices in python.??? what will be the code if i want to take input from the user to enter … | |
I want to replace 'nf' with 1.0, so that the resulting string should be: '(1.0+nfpermult+1.0)' I tried various approaches using find(), re.sub but I am not able to make it work. eg. re.sub('nf', '1.0', str) replaces all occurrences of nf. also re.sub('\bnf\b', '1.0', str) does not work either as 'nf' … | |
[QUOTE=vegaseat;250820]This little code shows 6 random integer numbers from 1 to 50 ... [code]import random print "show 6 random integers from 1 to 50:" for k in range(6): r = random.randint(1, 50) print r, print [/code] Rewrite the code to make sure there are no duplicate numbers amongst the six … | |
Okay, I'm creating a Battleship game. It's going to be using the console for now, still don't know GUI. Anyways, this is my issue. I have created two boards as lists, the first for the user, the second for the computer. I have the computer generate random numbers and a … | |
hi everyone ı have a very big text file which is 35mb and that includes 85000 lines. those lines are the rules of ıptales and from the command shell ı do paste and copy and as you can see it that ıs very diffucult to paste every lıne ı trıed … | |
Hi everyone, having trouble coming up with the right code for 8 directional movement [ up, upright, right, downright, down, downleft, left, upleft] My keypress handling is: [CODE] if event.type == KEYDOWN: if event.key == K_LEFT: player.moveLeft = True player.moveRight = False if event.key == K_RIGHT: player.moveRight = True player.moveLeft … | |
Hi, I want write a program which extract 'Rated PG for some scary moments and mild language' from the following html file and return it as a list . html file: <div class="info"> <h5><a href="/mpaa">MPAA</a>:</h5> <div class="info-content"> Rated PG for some scary moments and mild language. (also 2009 extended version) … | |
I'm not sure this is the correct forum for this, but it's at least relative. I was wondering if anyone knew of some decent references and ebooks for a beginning Django user.Yes, I know djangoproject has tutorials, but there decently hard to understand. If someone could either help or steer … | |
I need to convert a number (in decimal form) that is between 1 to 4999 to Roman Numeral Form. However, though the code I have is kinda working, its only outputting the thousand digit, not anything less or any part thats less. [code] def int2roman(number): numerals={1:"I", 4:"IV", 5:"V", 9: "IX", … | |
Hi, I am trying to pack a unicode string of 40 bytes using the pack method. [code=python] data = pack('<8sB40s', asc_time, language_id, message) [/code] it throws the following error: struct.error: argument for 's' must be a string What is the argument for a unicode string? Thanks in advance. | |
hi currently on my ubuntu i have both wx-2.6-gtk2-unicode & wx-2.8-gtk2-unicode installed, but when i use this code in python 2.6 : [CODE]import wx[/CODE] always wxwidget 2.6 was imported. is there any solution to have both or it's better to uninstall version 2.6 ? thanks | |
Hi all, I have this dilemma, if I receive strings on the form of: <Ranking: AA (John)> <Ranking: CA (Peter)> <Ranking: TA-A (Samantha)> And I want to take the ranking only from the strings (i.e. AA, CA, TA-A) How can I do it using string methods like split or strip … | |
hello, i want to utilize the demo code given in the wxpython 2.8 documentation & demos. can any one guide me how can i do that??? when i try to copy that code to editor to change it according to my requirements ..it gives me an error message and close … | |
Hi, I wonder how to use wx.FileDialog with turbogears . I have this turbogears project, and i have a form which add new employees, and for each employee i need to let the person who is adding them to pick a photo from his filesystem. And all wxPython guides already … | |
Hello everybody, I am having trouble to create the following script: I would like a screenshot been taken each time a click is detected. Also (if possible) to be able to modify the x and y of the size of the screenshot. There is my code (doesn't work yet): [CODE] … | |
Duh! I'm now using Linux from my external HDD again. Please suggest a good IDE for me Thanks | |
I really need help because of my senior project. I don't know the Python syntax and how I write. So please help me...! I have a prototype presentation on monday and I have to show login, logout and sending a mail code parts... Can you help meee???? pleaseeeee=(((( | |
Hi , Im trying to extract the number 7.2 from the html string below using python: '''<a href="/ratings_explained">weighted average</a> vote of <a href="/List?ratings=7">7.2</a> / 10</p><p>''' I thought this would be code to do this .But how come this doesnt work ? averageget = re.compile('<a href="/List?ratings=7">(.*?)</a>') average = averageget.findall(htmlr) Could it … | |
Would it be of interest to learn C or C++ if one already know python? I'm a linux and programming enthusiast (i.e hobbyist ;-) ) and C is pretty common on linux and many other applications. But is it worthwhile learning C if I already know python? What are the … | |
Hi all, How to write one file to the end of other file using python. | |
First: Yes I'm comparing apples to oranges but in this case it is kind of possible to compare them Context: I'm a php-developer for 3-4 years I think and I really like php, I also use python for 2 years. I recently came in contact with django (python framework) and … |
The End.