15,175 Topics
| |
This works with Python 2.7 [code]class B: def __init__(self, arg): print(arg) class C(B): def __init___(self, arg): super(C, self).__init__(arg) c = C('abc') # abc [/code]Here super() gives a TypeError: must be type, not classobj [code]from math import pi class Circle: """with Python3 object is inherited automagically""" def __init__(self, r): self.r = … | |
Probably the simplest way to get into multimedia with Python is the webbrowser module. This works with both Windows and Unix systems, and selects the default browser you have installed. But that is not all: if you give it the name of a multimedia file it will select the default … | |
I'm trying to get sounds to play from python. I've tried Winsound, snack, and now Pygame. Winsound only seemed to play windows preset sounds (which aren't so useful), snack did nothing, and Pygame is raising a memory error on a 2 second mp3. Is there something obvious I missed in … | |
Hi everyone, I have created a random text generator -ok, not so random, works with certain parameters- and at times it runs slowly. I looked up on the internet about speeding tricks and applied some of them that looked concurrent with my code piece. The code however, is still slow … | |
I have a question in Inheritance(Python): Write a class named Person with data attributes for a person's name, address, and telephone number. Next write a class named Customer that is a subclass of the person class. The Customer class should have a data attribute for a customer number and a … | |
Hi, I am in need of a python ocr script that can convert images into text and for the script to work on BOTH windows and centos. All the scripts I have found seem to not be compatible with linux/centos or require an api to another server and I do … | |
Hi all, I have just modified a mouse so that the left mouse button gets activated when a puck hits the net in ice hockey... Now all I need is for python to react to the hit by sending an output of voltage for a period of time and adding … | |
Hi all, I wrote code to list primes that are in a given "radius" of an even number. For example, 6 - 1 = 5 and 6 + 1 = 7, 14 - 3 = 11 and 14 + 3 = 17, etc. I used Euler's sieve to obtain the … | |
Vega had nailed a "Starting Python" thread. I though there should be a place for proposing intermediate and advanced projects so that one can have something to do to improve their skills more. Especially for those who don't do alot of math enough to get the challenges of project eura … | |
so I'm using the 'initialfile' to automatically generate the name of the import file, but I'm using 'defaultextension' to set the extension when clicking 'Save' how do I set the 'defaultextension' based on the current filter selection?? | |
Okay, so I'm currently working my way through Beginning Python: From Novice to Professional, and I'm up to the networking stuff. I consider myself at least an intermediate Python programmer, but the network stuff is really confusing me. I'm trying to get the hang of it by writing a simple … | |
Hi all, Is there any way to do forward referencing or function prototyping in python..? Being an interpreted language, is lack of forward referencing a drawback of python? | |
Hej Guys, I am not a phyton programmer, just on [url]www.luxrender.net[/url] (open source project) we have this annoying problem when we need to dl something the phyton mercury doesnt pass the file size to browser... Can somebody take a helpful look at it? I am sure its just something worng … | |
I've tried to make a program that will sort the results of a competition, by asking the user the number of competitors, then the name and score of each one. It worked but now i have to make it recognize when two or more people get the same score (that … | |
Hello, so I'm fairly new to python and I have become stumped on this one problem. As much as I would like you to solve the problem for me, I do not want you to do so without explanation, I would much rather have a step by step procedure. After … | |
Hey everybody. I was reading some code on the website and I saw this: [CODE]with open(FILE) as number_file: lucky_numbers = [set(line.strip().split('-')) for line in number_file] [/CODE] What does "with ... as ..." mean? What is it used for? How is it used? | |
hii..m stuck in an issue...and need a help I have Try.c file having contents ValidateFunction() { ...... ...... print } .... I want to print data between the braces {....}. Also i do not want to read the contents of file line by line because file is of very big … | |
[url]http://paste.pound-python.org/show/941/[/url] Having trouble getting a loop to write to a series of newly created sequential blank .wp files. Grateful for any help, thank you. Regards & a Happy New Year! Banjoplucker. | |
I have a share -//192.168.0.11/myshare which has many files in it. Which is the best way to delete all the files in this directory using python? I tried: [CODE]import os folder = '\\192.168.0.12\myshare1' for the_file in os.listdir(folder): file_path = os.path.join(folder, the_file) try: if os.path.isfile(file_path): os.unlink(file_path) except Exception, e: print e[/CODE] … | |
Hi, I am trying to install the Python4Delphi components, but it doesn't compile (from python4delphi.googlecode.com/svn/trunk). It also seems out of date. What is the best current way to use Python inside Delphi? Any advice or help will be greatly appreciated. Thanks! | |
Hello, This is a really simple question but I just don't see the error here: [CODE]def foo(): x = input('write something: ') if x == 1 or x == 2: print('OK') else: print('NO') print(x)[/CODE] Why does it keep printing NO? Also, I have a more complicated one: def foo(x, y): … | |
Hi all, i was writing a gui for a small desktop application i made as a part of learning python.I use python 2.7.I used Tkinter.I am new to python and this was my first trial with Tkinter. First i created 9 buttons arranged in the form of a 3*3 matrix … | |
So I have a program I am making but I need to make it more efficient, is there any way to condernse the following code into a more compact and efficient code? [CODE]r1p1=o r1p2=o r1p3=o r1p4=o r2p1=o r2p2=o r2p3=o r2p4=o r3p1=o r3p2=o r3p3=o r3p4=o r4p1=o r4p2=o r4p3=o r4p4=o r5p1=o r5p2=o … | |
I wrote this as reaction for Pascal newbie's question in Pascal Delphi forum. | |
Hello all!!! It's been a while but glad to have enough time to be back. My question is basically one of design. I'm working on a new project using pygame at the moment, mainly to brush up on and enhance some Object Oriented skills. The project itself is basically going … | |
| Hello, I am a newbie in python. I have a unicode in Tamil. When I use the sys.getdefaultencoding() I get the output as "Cp1252" My requirement is that when I use text = testString.decode("utf-8") I get the error "UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-8: character maps to … |
Hey fellows, I've created a fairly large math suite for my spectrometer research, which is basically a set of programs that does several math operations, generates plots etc... It's beginning to get pretty bulky, and seems like it would benefit from a nice class; wherein, I could store all the … | |
Hey friends lets checkout a small, simple and cute python program for taking photos with with your webcam without the help of any third party application programs. [CODE] import os import datetime import opencv.adaptors from opencv import highgui import Image def get_image(camera): im = highgui.cvQueryFrame(camera) # Add the line below … | |
I wrote a program which I tested in the IDE of python 3.2, it worked but whenever I open the program directly or run from command prompt, it doesn't run correctly, after the user inputs the correct answer, the program keeps saying try again. [URL="http://www.daniweb.com/software-development/python/code/359115"]here's the program it's in the … | |
Hello everyone, I have created my own random text generator with a custom method, no Markov chains included, and now I would like to try it on a different text corpus that is larger from that of NLTK's and I wanted to know which Data structure should I use in … |
The End.