15,190 Topics

Member Avatar for
Member Avatar for hughesadam_87

Hi, I have several functions that I'd like to operate on both mutable and immutable containers (mostly tuples vs. objects) and I'm looking for the optimal way to test for mutability in these objects. I can think of many ways to do this. For example: try setattr: do mutable stuff …

Member Avatar for hughesadam_87
0
113
Member Avatar for thekilon

If you are a non coder that wants the easiest book to start with, something very simple, easy to read and short , that can take you step by step in learning the basics of python in a few hours then you may like the book I have created for …

Member Avatar for thekilon
2
397
Member Avatar for TrustyTony

There was discussion thread http://www.daniweb.com/software-development/python/threads/424953/polynomial-division for class based implementation for polynomials, and I developed a version utilizing the magic methods to enable operation with normal arithmetic operation. I only inherited sequence structure from list type. Interoperability with scalar types is not implemented to avoid too complicated type checks of the …

Member Avatar for TrustyTony
1
1K
Member Avatar for sokolov

I am new to python but have experience with Java. I am creating a bouncing ball program which throuhg a for loop creates a large sum of bouncing balls. I appreciate any help! Thank you import time from random import randint x0 = 10.0 y0 = 10.0 ball_diameter = 15 …

Member Avatar for TrustyTony
0
1K
Member Avatar for hughesadam_87

Hi, I have an object subclass that I am using with a cusom __repr__() method. class NewClass(object): def __repr__(self): return ', '.join('%s=%s'%(k, v) for (k,v) in self.__dict__.items()) This works fine (leaving out some more details about my program): test=NewClass(a=1,b=2) print test a=1, b=2 But what I really want for reasons …

Member Avatar for hughesadam_87
0
182
Member Avatar for Frensi

I'm learning about Classes and this thing is driving me crazy. Whenever I run this, it will use the __del__ object even though I never used del droid1, del droid2, or del droid3. Can someone please help? class Robots: '''Represents a robot, with a name.''' #A class variable, counting the …

Member Avatar for Gribouillis
0
303
Member Avatar for blackarchan

I have a problem i wrote a code and copyed some code but now my sprite dosent move anymore....and i dont know why # Import a library functions called 'pygame' import pygame from pygame.locals import * # Initialize the game engine pygame.init() # Define some colors black = (0, 0, …

0
146
Member Avatar for satnav_8

I'm trying to write a script that will search a page for mp3 files, and download the first one. All is fine, but when I'm finding the links the first two are not mp3 files. At the moment I'm doing: for link in page.findAll('a')[:3]: f.write(link.get('href')) This finds the first 3 …

Member Avatar for satnav_8
0
128
Member Avatar for Twist43

Hi I have always been a windows user but a few months ago switch to Ubuntu Linux. I have started learning Python and want to find out from experienced developers what the best way is to setup a development environment on a Ubuntu machine. I am running Ubuntu 12.04 which …

Member Avatar for Twist43
0
183
Member Avatar for hughesadam_87

This post is a followup to an older dicsussion [on recordmanaging](http://www.daniweb.com/software-development/python/code/429753/custom-named-tuples-for-record-storage). I am writing this to share with colleagues, so it may be a bit fluffy and not straight to the point. I apologize to all the experts. Good programs always start by managing data in a flexible and robust …

0
574
Member Avatar for Skrell

I recently came across this code on the internet and I'm having a very hard time understand how it works. I was hoping someone could comment the code a bit in order to help me learn it better? I understand most of it, but get lost when any of the …

Member Avatar for Skrell
0
292
Member Avatar for fasna

Write a function estimatePi() to estimate and return the value of Pi based on the formula found by an Indian Mathematician Srinivasa Ramanujan. It should use a while loop to compute the terms of the summation until the last term is smaller than 1e-15. The formula for estimating Pi is …

Member Avatar for fasna
0
727
Member Avatar for ryantroop

So, I would like to start working on a python module to support RFC 2326 (RTSP), in an effort to work on a larger application that I will probably need help with later. I am unsure how to go about making software that is meant to adhere to a specific …

Member Avatar for ryantroop
0
276
Member Avatar for sandorlev

Hey guys! I've started writing a 2d platformer game some days ago, and I'm really enthusiastic about it, but I already failed to live up to my own expectations: I just cannot possibly think of a way I could make my character jump. I used the MVC desing is why, …

Member Avatar for 3e0jUn
1
341
Member Avatar for deepthought

Hi Guys, I have managed to connect to a laser sensor and get data back from the unit into python however i think i need to decode this data. Below is what i have sent and get back. Console Result:- UDP target IP: 192.168.60.3 UDP target port: 9008 message: FF …

Member Avatar for deepthought
0
132
Member Avatar for Zeref

Hi guys. I'm trying to access some User interface files (.glade) which are in a subdirectory. from gi.repository import Gtk import os path=os.getcwd+'/ui/main.glade' def hurr(): builder=Gtk.Builder() builder.add_from_file(path) # get UI file window=builder.get_object('winlet') window.show() hurr() Gtk.main() This works if i use only 1 glade file, but i have multiple .glade files …

Member Avatar for solivier
0
158
Member Avatar for 3e0jUn

For some reason , my code keeps returning a false reply even if the string is in the file. Here's my code: def check(self): self = str(self) if self in config_file: print ('Account exists') if self not in config_file: print ('Account doesn't exist')

Member Avatar for Gribouillis
0
164
Member Avatar for fasna

In the pencil-and-paper game, Tic-tac-toe, 2 players take turns to mark 'X' and 'O' on a board of 3x3 squares. The player who succeeds in marking 3 successive 'X' or 'O' in vertical, horizontal or diagonal stripe wins the game. Write a function that determines the outcome of a tic-tac-toe …

Member Avatar for Gribouillis
0
334
Member Avatar for scott.richardson.988373

I have checked various examples and it appears that my problem is a bit more complex than what I have been able to find. So I'd greatly appreciate your help. I'm a stress engineer and I like to present my results as VRML (WRL) files. I recently discovered how to …

Member Avatar for scott.richardson.988373
0
191
Member Avatar for pato

Hey, I'm new to Python, as well as this message board, and I was wondering what some of the most useful and frequently-used commands are. I've so far only learned while, if, print, input # and words, and can make some basic programs only. I've previously had experience in TI83 …

Member Avatar for PythonHelper
0
1K
Member Avatar for toyotajon93

Hey guys I hope you can give some help, I have read alot and cannot come up with a solution. Here is what I'm trying to do, I return a set of values from a web request [[1, 0, 1], [2, 0, 1], [3, 0, 1], [4, 0, 1], [5, …

Member Avatar for Gribouillis
0
172
Member Avatar for wassupB

Write a program that asks the user's name, then prints: Hello, <name>! For example: Enter your name: Tara Hello, Tara! Hint Make sure you give raw_input the same prompt message that is used in the example interaction above.

Member Avatar for TrustyTony
0
34
Member Avatar for Mahesh57

Hi,I have a PYTHON Task http://www.jjoseph.org/misc_projects/meter_reading_with_a_webcam and i need to chnage it to C# the Python code is available in the above mentioned task link or http://www.jjoseph.org/files/gasmeter/meterparser.py please help me as soon as possible i am begginer to C# code please responde as soon as possible.Thanks in Advance

Member Avatar for Gribouillis
0
385
Member Avatar for peterparker

I have written the following code for Towers of Hanoi problem using non recursive approach. I guess it is not correct as the number of moves are not 2*n - 1, for eg, for 3 disks to be moved, it has to generate 7 moves. Thanks in advance. ###################### # …

Member Avatar for peterparker
0
2K
Member Avatar for aint

Hi, I am working on Protein and DNA sequences. When you have a protein sequence it can be translated in to DNA sequence in many ways. A nice way to express this is using regular expression. I would like to create this long regular expression for a protein sequence, and …

Member Avatar for TrustyTony
0
317
Member Avatar for dsplayer14

Well, here is my code: print "Welcome to the English to Pig Latin translator!" original = raw_input("Please enter a word: ") pyg = "ay" if len(original) >= 1 and original.isalpha() word = original.lower() first = word[0] if word == a or e or i or o or u print "Your …

Member Avatar for dsplayer14
0
4K
Member Avatar for avidthrows

Hi, I want to implement a basic license key verification system into my software. I know the basics of python and pygame, etc, but I've never read anything about implementing this type of drm into my software. Quite frankly, I don't even know where to start. Yes, I understand that …

0
130
Member Avatar for dlsauers

I am converting a program in python that is written and used on another OS that starts with the letter w. The script as written works on that OS, but on Linux it seems to fall flat on its face. First, I do not have access to any non Linux …

0
238
Member Avatar for hughesadam_87

This code was inspired after several discussions on the forum, and I'm especially indebted to PyTony for all of his help with these aspects. The motivation behind this code is quite simple. I wanted a robust, light and general way of storing CSV data that could be used over and …

Member Avatar for TrustyTony
2
533
Member Avatar for sarelnet

Hi, I'm very new in Python and I have to write an file interpretor (first ex from university). The file looks like: joker NAME_OF_BLOCK bla bla { block_field abv : bit : R ; block_field acd : byte : RW ; block_field zza : bit : R ; block_field aw …

Member Avatar for sarelnet
1
146

The End.