15,181 Topics

Member Avatar for
Member Avatar for xvalentinex

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

Member Avatar for xvalentinex
0
87
Member Avatar for Stefano Mtangoo

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?

Member Avatar for Stefano Mtangoo
0
146
Member Avatar for vegaseat

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

1
562
Member Avatar for deonis

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

Member Avatar for deonis
0
270
Member Avatar for hdk

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 …

Member Avatar for Stefano Mtangoo
0
349
Member Avatar for lewashby

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 …

Member Avatar for jcao219
0
108
Member Avatar for Kruptein

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)

Member Avatar for hondros
0
304
Member Avatar for rmsagar
Member Avatar for vegaseat
0
198
Member Avatar for eva yang
Member Avatar for vegaseat
0
127
Member Avatar for punter999

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 …

Member Avatar for vegaseat
0
141
Member Avatar for kbalamuk

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

Member Avatar for vegaseat
-1
6K
Member Avatar for badboy00z

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

Member Avatar for badboy00z
0
847
Member Avatar for hondros

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 …

Member Avatar for hondros
0
101
Member Avatar for rehber344

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 …

Member Avatar for woooee
0
184
Member Avatar for BlackPhoenix

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 …

Member Avatar for JugglerDrummer
0
298
Member Avatar for masterinex

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

Member Avatar for vegaseat
0
233
Member Avatar for Democles

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 …

Member Avatar for Stefano Mtangoo
0
79
Member Avatar for curiouskitten

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

Member Avatar for vernondcole
0
4K
Member Avatar for vsagarmb

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.

Member Avatar for d5e5
0
164
Member Avatar for mehdi0016

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

Member Avatar for vegaseat
0
92
Member Avatar for El Duke

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 …

Member Avatar for vegaseat
0
136
Member Avatar for punter999

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 …

Member Avatar for vegaseat
0
96
Member Avatar for fferrandini

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 …

Member Avatar for Stefano Mtangoo
0
95
Member Avatar for Benou

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

0
36
Member Avatar for Stefano Mtangoo

Duh! I'm now using Linux from my external HDD again. Please suggest a good IDE for me Thanks

Member Avatar for Stefano Mtangoo
0
123
Member Avatar for gzm_e

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=((((

Member Avatar for Stefano Mtangoo
0
73
Member Avatar for masterinex

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 …

Member Avatar for ghostdog74
0
99
Member Avatar for mahela007

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 …

Member Avatar for Narue
0
135
Member Avatar for rajeshwari_ib
Member Avatar for eva yang
0
7K
Member Avatar for Kruptein

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 …

Member Avatar for ShawnCplus
0
58

The End.