15,190 Topics
![]() | |
Is there any difference between polymorphism implemented in c++ and the one implemented in python ? | |
[code] class A: def __init__(self): print 'A()' class B(A): def __init__(self): A.__init__(self) print 'B()' class C(B): def __init__(self): B.__init__(self) print 'C()' c = C() [/code] Cans omeone help me explaining what am I doing wrong here? I`m getting an error like: [code] B.__init__() TypeError: unbound method __init__() must be called … | |
hi all........ file1 99 root S 5176 95 [B]41.2[/B] 8.3 snmpd file2 99 root S 5176 95 [B]1.0 [/B] 8.3 snmpd i want to caluculate difference between two files fifth column(i.e bolded columns as mentioned above).. thanks in advance...:'(:) | |
I have two codes in C and in Python. They gave me different results. Can anybody explain how they works, why I get different results? Thank you in advance!!! In C: ----------- #include <stdio.h> int main() { int a = 100; printf("%d = %02x\n", a, a); a = ~a; printf("%d … | |
Hi guys, this is the first time for me to post something, i'm really a big fan of the site and so far every time i get stuck in something at uni i come to here. so thanks for helping me survive so far. anywho, i'm here because i need … | |
You can download the matplotlib free from: [url]http://matplotlib.sourceforge.net/[/url] It has, amongst many other things, the module pylab that allows for high quality plotting of data. All you have to do is to feed it a list of x values and the corresponding list of y values calculated from the x … | |
I am having a problem using the common dialog in PyQT. For some reason, when I try and import 'QFileDialog', I get a not found error, same with importing QDialog. I am on Py 2.7 (was 2.6) using 'PyQt-Py2.7-x86-gpl-4.8.2-1'. I can import QTCore and QTGui just fine. I thought PyQT4 … | |
Hello, Iam trying to get a table from the html page.I succeeded in getting the table values.But i have problem in getting the field names in the 1st column. [CODE]# Getting the field names.How to strip the 'b' and get only the names paramKey = table.findAll('b') print paramKey[/CODE] The above … | |
Hey guys, I've been lurking around these forums for a few weeks now, and this website is by far the most helpful of any site I've visited as far as honing my newfound Python skills, and I figured it's time I jump in and ask some of the more specific … | |
Hey guys...Need some help with a program for class...here's the assignment If your program detects an error condition, you can make it raise an exception. Here is an example that gets input from the user and checks for the value 17. Assuming that 17 is not valid input for some … | |
hey guys and girls i am having a bit of a problem with my code [CODE] import os,string,sys,pprint,time,glob from datetime import datetime, timedelta fileList = os.walk('.')#if i use glob.glob it does not show any files now = datetime.now() TWA = now + timedelta(days=-1) #print(TWA) files=str() for files in fileList: fileStats … | |
I am relatively new to Python and just have a couple quick questions about using file paths in Python code. 1) As I was recently playing around with the command line, I could not get a file path to work correctly unless I used forward slashes in the path...for example: … | |
Why I have not seen any underline with the menu items although I have put "&" within the menu names. My code is as follows: [CODE]import wx import os class MainWindow(wx.Frame): def __init__(self, parent): self.dirname='' # A "-1" in the size parameter instructs wxWidgets to use the default size. # … | |
[code] a = 10 def foo(x = a): print x a = 5 foo() [/code] Can someone explain why it prints 10 ? | |
Hey Guys, I have a minor problem with pytesser for the internet!!! I want to create a program that calculates equation from the internet. I need pytesser to recognize the equation and python to calculate it. Example: 5 + 5 = [ ] Then Sendkeys will type the answer in … | |
I am trying to figure this problem out but I can't seem to get the code right. Please help. OUESTION: Implement a subclass of list called myList. It will behave just like the list class except for iteration: Usage: >>> l = myList([3,5,7,9]) >>> for item in l: print(item) 3 … | |
hi... using pysnmp, an 'snmp get' varBinds gives me an 'octet string' of values like: 1+1 Protection; East-West; Spiral Search; ODU Enable/Disable I need to loop through these strings and see whether a particular string say, 'East-West' is present. I am not finding way to do this. can this octet … | |
Hi... I want ti contril the while loop, just make it looping just for x times, ex: loop for 5 times and pass to the next code :) | |
I've been trying to find information on this for a while, but I can't seem to find anything. I want to use python to send a command to the command prompt, then instead of sending the output to the console window, put the output into a variable that I can … | |
I've built a Counter (which is not implemented for python 2.6) for reading a sequence file of strings to a dictionary and trying to return those sequences are unique for that file/a number of files. I use sequences with a length of X-characters as key in my dictionary and put … | |
hello there guys. im quite confused regarding the use of pyserial classes. ive been reading up on the pyserial documentation. i followed an example and used the code below [CODE]import serial ser = serial.Serial (0 , baudrate = 57600 , timeout = 1) #open serial port (1) - 1 line … | |
Im pretty new to python so im still finding my feet.. Ive written a small ftp program that downloads a file but its quite basic in that it gets the last element from the list and then downloads it. What is the easiest way to add some logic so it … | |
Hi, I'd like to find the maximum value in a list but be able to state certain exceptions. For example: if list A=[1,5,3,4] I want to say [CODE]max(A) except index 1[/CODE] which would return '4' as the maximum value. Is there a way of doing this? Thanks. | |
When I execute; tkFileDialog.askopenfilename(title='Open file', filetypes=[('csv files', '*.csv')]) I get a file open dialog just fine, but there's also a blank TK panel about 2 inches square with nothing in it titled 'tk' behind the dialog. What is it, and how do I make it go away? I'm on Windows … | |
I can't get images to load.. I always get an error here's my code so far: #pong import os, sys import pygame from pygame.locals import * if not pygame.font: print "Warning, fonts disabled" #-------------------------------------------------------- def load_image(name, colorkey=None): fullname = os.path.join('data', name) try: image = pygame.image.load(fullname) except pygame.error, message: print 'Cannot … | |
How can I get my editor to expand both horizontal and vertical? I have a simple test application that uses a subclass of a StyledTextCtrl. I create my editor object in a subclass of wx.Frame. [CODE=python] def CreateEditor(self): myEditor = editor.SyntaxControl(self) # subclass of StyledTextCtrl sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(myEditor, 0, … | |
So i made a small game using pygame, and I want to be able to give it out to some friends who don't have python, so I want to make it into an EXE. i've been trying for several hours using several different methods, but nothings seems to be working. … | |
![]() | Hello everybody!! I know that the topic "compiling python script" is a very popular topic, and there are informations about it everywhere on the net. I use windows and want to make a .exe-executable My problem: Everything I found... * is to old * does not work (exe has an … |
import urllib.request page = urllib.request.urlopen("http://www.randompickupline.com/") text = page.read().decode("utf8") where = text.find('<p id="pickupline">') start_of_line = where + 18 end_of_line = start_of_line + 150 line = (text[start_of_line:end_of_line]) print (line) This is a basic html import for a text based game I'm writing for fun, and I'm making a dynamic string. However, the … | |
hi all.......... 1)~ # free cat /proc/meminfo total used free shared buffers Mem: 62192 32080 30112 0 0 Swap: 0 0 0 Total: 62192 32080 30112 2)~ # free cat /proc/meminfo total used free shared buffers Mem: 62192 32440 29752 0 0 Swap: 0 0 0 Total: 62192 32440 29752 … |
The End.