15,185 Topics

Member Avatar for
Member Avatar for Beat_Slayer

Aproach to the implementation of K-Nearest Neighbor (KNN) using the Euclidean algorithm. Sample Usage: [CODE]mywork = Words_Works() lit = 'literature.txt' mywork.add_category(lit, 'Literature') # adding files as category comp = 'computers.txt' mywork.add_category(comp, 'Computers') phy = 'physics.txt' mywork.add_category(phy, 'Physics') # saving categories dictionary to file mywork.save_categories() # can be loaded calling load_categories() …

Member Avatar for Beat_Slayer
0
792
Member Avatar for plasticfood

[CODE]import wx class bucky(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,'Frame aka window', size=(400,300)) panel=wx.Panel(self) status=self.CreateStatusBar() menubar=wx.MenuBar() first=wx.Menu() second=wx.Menu() first.Append(wx.NewId(),"new window") first.Append(wx.NewId(),"Open...") menubar.Append(first,"File") menubar.Append(second,"edit") self.SetMenuBar(menubar) if __name__=='__main__': app=wx.PySimpleApp() Frame=bucky(parent=None, id=-1) Frame.Show() app.MainLoop() [/CODE] when i run this program, i get a "self is not defined in status=self.CreateStatusBar()". so i erased that part, and it …

Member Avatar for plasticfood
0
151
Member Avatar for student_

I am trying to make a program which so i can put in orders and have shopping and handling calculated the problem is, each time i run the program there will be a different number of people placing an order, how would i set up a loop that on each …

Member Avatar for vegaseat
0
286
Member Avatar for JDuch

""" Hi i intended to list the built-in function using this function. It seems however to give me the results corresponding with a dictionary. Why is that ? """" [CODE] def showbuiltins(): """ saves the list of built in functions to a file you chose """ blist = dir(__builtins__) print …

Member Avatar for JDuch
0
186
Member Avatar for nekogda

Here's a simple question. Need: => to use scipy special package function in my python prog (python2.6). 1. Downloaded & intalled numpy for python2.6 2. Downloaded & intalled scipy (scipy-0.8.0-win32-superpack-python2.6.exe) tested: import numpy import scipy - everything's ok According to scipy docs, a package needs to be loaded before a …

Member Avatar for nekogda
0
209
Member Avatar for fekioh

Hello, I need to store data in large lists (~e7 elements) and I often get a memory error in code that looks like: [code=python] f = open('data.txt','r') for line in f: list1.append(line.split(',')[1]) list2.append(line.split(',')[2]) # etc. [/code] I get the error when reading-in the data, but I don't really need all …

Member Avatar for ultimatebuster
0
2K
Member Avatar for acrocephalus

Hello! I am trying to creat an "About box" with wxpython. I have defined this function [CODE]def OnAboutBox(self, event): info = wx.AboutDialogInfo() info.SetIcon(wx.Icon('icons/exit.png', wx.BITMAP_TYPE_PNG)) info.SetName('Watermark Image Processing') info.SetVersion('1.0b') info.SetDescription(info) info.SetCopyright('(C) 2010 Daniel Valverde') info.SetWebSite('http://www.acrocephalus.net') licenseFile = open('license.txt') info.SetLicence(license) info.AddDeveloper('Daniel Valverde') info.AddDocWriter('Daniel Valverde') info.AddArtist('Daniel Valverde') info.AddTranslator('Daniel Valverde') wx.AboutBox(info)[/CODE] I know that …

Member Avatar for acrocephalus
0
411
Member Avatar for hondros

Well, since there was no option for "tutorial" in the type of post, it has been created as a simple thread... Obfuscation - confusion resulting from failure to understand obfuscated code - Code that is hard to read In this tutorial, I will show you how to convert something readable, …

Member Avatar for hondros
2
162
Member Avatar for Tarkenfire

Okay, so in all honesty, I began learning Python about 2 days ago, so this is a rather noobish question(well, I've programmed in other languages, so it's not THAT noobish), but I'm making an IRC bot and can't figure out how to make it so that a line of code …

Member Avatar for Tarkenfire
0
213
Member Avatar for lewashby

In the following program can someone help me figure out why the close button [X] at the top right corner isn't working? [CODE] # imports from Tkinter import * from sound_panel import * import pygame.mixer # create gui app = Tk() app.title("Head First Mix") # create mixder mixer = pygame.mixer …

Member Avatar for vegaseat
0
82
Member Avatar for jenzilla

What am I doing wrong? [URL="http://www.daniweb.com/forums/post1298887.html#post1298887"]http://www.daniweb.com/forums/post1298887.html#post1298887[/URL]

Member Avatar for vegaseat
0
54
Member Avatar for PythonNewbie2

Hey guys, I'm parsing some XML using minidom and whenever a comment has a "--" within it, I get an ExpatError. For example, a file may be like this: [CODE] <Label> Hello!</Label> <!-- The above label says Hello. -- It is clear, no? Let's try spicing it up a bit. …

Member Avatar for snippsat
0
2K
Member Avatar for Viasur

Hello all. First I have to let you know that Im a total newbie trying to understand Python using the book 'A byte of Python'. I'm following everything on that book and is been kind of fun until OOP (object orient programing). Im getting an error in most of the …

Member Avatar for Viasur
0
1K
Member Avatar for Aiban

Hi With every piece of code i download to check out, i often find with python 3.1/Windows Vista that the code will start with from Tkinter import * but i need to change it to from tkinter import * as it seems to be case sensative, i tried renameing the …

Member Avatar for jgomo3
0
12K
Member Avatar for pdini

Hi all, I developed a GUI application using PyQt which comport a QGraphicsView. In this QGraphicsView I have a QGraphicsScene with a lot of items (more than 10'000): polygons, rectangles, texts, etc. How can I save it as an image like it appears on the screen (.png for example)? I …

Member Avatar for pdini
0
2K
Member Avatar for dr_zoidberg1

Hi everyone, i’m new to this board, and i’m having a bit of trouble plotting lines inside of a function, perhaps someone knows what i’m doing wrong! I’m trying to plot an X where the points have been clicked, this is all for a wider picture that is going to …

0
97
Member Avatar for bettersaid

hello! i've been trying to create an automated task which it should: 1. open Print 2. choose Printer 3. change Paper Size ( i want to print my doc in all paper size) but i find my code too long and oh i dont know, and i want to simplify …

0
139
Member Avatar for pythonbegin

Hi all How can I create a csv file with header. I have a text file with several number of blocks staring from "//" and ending a block with "//". I have attached a sample file. I want to use first column of this text as a header of csv …

Member Avatar for pythonbegin
0
1K
Member Avatar for Kruptein

I'm fetching a list with all files/folders on a ftp-server, I want to put a [F] before a folder, and leave files like they are, but I can't find a way to check if it's a file or a dir... I already tried: [code=python]from ftplib import FTP import os ftp …

Member Avatar for Sunjay03
0
7K
Member Avatar for PythonNewbie2

Hi guys, I want to add a custom footer to all of my word documents like "This document was written by PythonNewbie". Let's say all of the reports are in a single directory. Here's some code that I have which can do through and find files... Now I need a …

Member Avatar for Beat_Slayer
0
96
Member Avatar for sandhya1202

[QUOTE]Actually i would like to do steaming,stopword removal,word count and punctuation marks removal from my text data i found code for this in DaniWeb[/QUOTE] [CODE]import string def RemovePunc(): line = [] i = 0 text_input = "" total_text_input = "" #This part removes the punctuation and converts input text to …

Member Avatar for Beat_Slayer
0
636
Member Avatar for PythonNewbie2

Let's say I have my own installer for a product that uses a lot of other components. One piece of my product is a python script. However, most of my end-users don't have python installed already. Is there any way I can include the python installer as part of my …

Member Avatar for Beat_Slayer
0
192
Member Avatar for reviloera

Guys I need help am using fedora 13 KDE desktop I want to install Qscintilla and its pyqt4 wrapper when a run [CODE]qmake qscintilla.pro [/CODE] I get an error message.........(bash: qmake command not found) thanxs

Member Avatar for woooee
0
99
Member Avatar for tmd200

Hi, I have a question about the color options in matplotlib. First, some calculations are done, which results in a nested list, which contains for each variable (A,B,C etc.) the values at particular time points. I can plot this like, which gives a nice figure, where every variable has it's …

0
27
Member Avatar for koveras vehcna

Hello everyone, I am currently working on text processing with Python and I want to parse a .txt file into its sentences as a whole. I tried to create some regular expressions but I failed to do so. I only managed to come up with a regex that splits each …

Member Avatar for TrustyTony
0
1K
Member Avatar for -ordi-

Hei, [CODE]list = [line.split() for line in open(file) if line is not None][/CODE] and output: [CODE][linux@localhost ~]$ [[], ['text'], ['text', 'text', 'text', 'text'], ['text', 'text', 'text', 'text']][/CODE] How to remove none types [] or something.

Member Avatar for -ordi-
0
137
Member Avatar for andrewtrench

I have a perplexing problem which may turn out have a simple solution (hopes!). I am writing a little GUI to allow a user to enter information which will get built into an XML file which is linked to flash-based graphic. One of the fields I have is a Tkinter …

Member Avatar for andrewtrench
0
130
Member Avatar for reviloera

I have started programming in python . I want to know the best GUI binding to use .pyqt and wxpython which one is the best and easy to learn and install on federa 13

Member Avatar for vegaseat
0
84
Member Avatar for andrewtrench

Hi. I'm fiddling around with Python and MySql. I keep getting an error with this little script to try and read the rows in a table. The error is: TypeError: unsupported operand type(s) for +: 'int' and 'tuple' Here is the code snippet. Any help would be hugely appreciated [CODE]import …

Member Avatar for andrewtrench
0
248
Member Avatar for eldeingles

Would like to be able to replace every [I]nth[/I] word in a text file with a blank space. I'm sure python is so capable.

Member Avatar for TrustyTony
0
316

The End.