15,185 Topics

Member Avatar for
Member Avatar for sravan953

Hey all, I'm working on a program where I calculate powers of two upto 60. I've made my own formula for calculating it which is: 10^([value of log 2 here]*y), where 'y' is any power as big as, say, 31. So here it is: [code=python] two=0.301029995664 final=math.pow(10,(two*n))-1 [/code] Now... as …

Member Avatar for TrustyTony
0
195
Member Avatar for Tommymac501

I cannot seem to get Reportlab's 4 state bar code to work. I keep getting "NameError: name 'USPS_4State' is not defined", yet if I 'dir' the module it's clearly loaded; dir(usps4s) arcode', 'USPS_4State', '__all__', '__builtins__', '__doc__', '__file__', '__ e__', '__package__', '__version__', '_crc11', '_initNof13Table', '_ru13', '_t The usage is correct as …

Member Avatar for Tommymac501
0
109
Member Avatar for baki100

Can this be done in python and which module would i have to look at. I haven't experimented with this and if I have to guess would it be the os.renames() function.

Member Avatar for baki100
0
90
Member Avatar for tiddster

Is there anyway, without using threading, to get python to do the following do for 5 seconds do action else do something else

Member Avatar for TrustyTony
0
59
Member Avatar for mahesham

Hi, My code opens Excel 97-2003 version Excel file correctly, but gives error when the Excel file is in 2007 (*.xlsx) format. How to solve this? - Mahesh

Member Avatar for mahesham
0
91
Member Avatar for echellwig

Hi I was wondering if there is any way to created a series of lists in a for-loop so that the first list created is named NAME0 or name_0 or indexed in some way. What I have right now is [CODE]for j in range(int(L)): popsizelocus_j=[][/CODE] however, this is not working …

Member Avatar for TrustyTony
0
48K
Member Avatar for Robertbra

Hey Guys : Here The problem is :to have a program to check the -(sys.argv) is long enough to have more than 3 elements if not then print "input more " -check (sys.argv) contain a specific elements for ex(P) ,& if P is found in the given elements then it …

Member Avatar for griswolf
0
112
Member Avatar for ITgirl2010

[code=php] class Item(object): def __init__(self, ID, name, price, stock ): self.ID = ID self.name = name self.price = price self.stock = stock def getID(self): return self.ID def getName(self): return self.name def getPrice(self): return self._price def setPrice(self,value): self.price = value def buyStock(self, howMany): self.stock += howMany def sellStock(self, howMany): if howMany …

Member Avatar for TrustyTony
0
119
Member Avatar for echellwig

Hi, I am trying to write elements from a list that I have created to an outfile using a for-loop with this code: [CODE]for j in range(int(Allele[i])): outfile.write(' allelelocus[j] * ')[/CODE] However when I do this I just get a whole bunch of allelelocus[j] in my out file. I was …

Member Avatar for echellwig
0
147
Member Avatar for aframe

I have a Python script that creates a Tkinter window running in Ubuntu. In the script I have an if/else statement that changes the background color based on a variable. That all works. What I cannot figure out how to do is when it changes the background color, I also …

Member Avatar for woooee
0
2K
Member Avatar for mastermoo420

I put the code on a pastebin thingy so this post would be easier to read. [url]http://paste.pocoo.org/show/229111/[/url] Anyways, basically, I have this 250MB text file that has a string of letters. 50 letters per line, and LOTS and LOTS of lines. I tried doing this before, but I got a …

Member Avatar for mastermoo420
0
106
Member Avatar for gangster88

Can someone help me with this code.. I get an error when I try to execute it [code] from graphics import * def main(): colour = raw_input("Enter the colour: ") win = GraphWin("Patch", 200, 200) drawCircle(win, 50, 50, colour) def drawCircle(win, x, y, colour): for i in range(5): for j …

Member Avatar for vegaseat
0
196
Member Avatar for tiddster

Does anyone know how to download the index page from the website using a python script? For a start, I don't understand the concept, google doesnt seem to throw up any relevant articles so am a little lost!

Member Avatar for Tech B
0
149
Member Avatar for echellwig

Hi, I am having some trouble using the int function on an element of a list. My code currently looks like this. [CODE]for j in range(int(L)): for k in range(int(Allele[j])): alleleslocus_j.insert(k,loci.readline())[/CODE] where Allele is a list of length L inputted by the user. I am having problems with the second …

Member Avatar for echellwig
0
177
Member Avatar for SoulMazer

Okay, I'm not sure what's going on, but tkSnack [URL="http://www.speech.kth.se/snack/"](link)[/URL] is deciding to not work for me all of a sudden. I have written a full-blown freaking media player with it, and I am now failing to simply play a song from the command line. I can get it to …

Member Avatar for SpeedyWizard
0
97
Member Avatar for ryan461

I've got a couple of pdf's on python, but im having trouble grasping how to build classes. Was trying to do it for a poker program and i think im in over my head with that idea. (its a bit big just doing it with functions). So id like an …

Member Avatar for ryan461
0
121
Member Avatar for Simes

[CODE=python]#Code should always be in a method or class #Always start variable names with lowercase, classes could be capital #input.upper() allows the user to use lower or upper case for each option import random from operator import itemgetter def isint(x): try: int(x) return True except: return False print "Invalid guess. …

Member Avatar for Simes
0
103
Member Avatar for tiddster

I have a list containing strings. I want to make a directory for each item in the list, with the name of the directory being the string. Does anyone know if this can be done, and it so, how?

Member Avatar for raj_developer
0
214
Member Avatar for appunu

Hello people, I am writing my own python code which calls a batch file to execute a download files from the ftp, the file size varies regularly.. is there any way to pause the execution of the code until the download completes. ?? i am struck in this part of …

Member Avatar for TrustyTony
0
94
Member Avatar for sandorlev

Hello, guys! I've written a GUI for a program. It's written like shit, the goal was to get it done fast. Well it didn't exactly work out, so when I refresh the data, every label disappears. Here is the code: [CODE] class GUI: def __init__(self, master): self.master = master self.label …

Member Avatar for TrustyTony
0
10K
Member Avatar for MikexDetroit

I am trying to work with cImage. But I cant get my second window to load up my img file. It always bring up a window with out the img. I have been playing with it for an hour and a half now and im thinking it has to be …

Member Avatar for TrustyTony
0
69
Member Avatar for mediachicken

Hello, I've been studying PHP for a while now, and am tackling my biggest project so far. I need to parse python code (which I'm already doing) and color code it. I need to get a word RIGHT before the ( symbol. I've tried just about everything, and can't get …

Member Avatar for vaultdweller123
0
144
Member Avatar for SoulMazer

Ugh, this is quite frustrating. I am writing a series of CGI scripts with Python that all work perfectly until I add in a stylesheet reference. Interestingly, if I put the styling rules inside the CGI script, it runs perfectly; it only throws an error when it is in an …

0
120
Member Avatar for Greyhelm

I have been working further on my text adventure (see thread: [url]http://www.daniweb.com/forums/thread285737.html[/url]) and have come to the part where I would like to manage the change of time (of day) and adjust the date as time passes. I have some code that does it, but was wondering if there is …

Member Avatar for Greyhelm
0
526
Member Avatar for angraca

I am new to python and this is my first program. The program factorize a number given by a user. It also makes a list of all the primenumbers, that it finds and stores them in a file. Is there anybody who can see a way that I can make …

Member Avatar for vegaseat
0
916
Member Avatar for chavanak

Hi, I have written a script which parses a UTF-8 text file and prints the required result. The code is below: [CODE] import os import sys import string import csv import codecs usage = "usage: Specify the directories for files and the RDOCK cut-off value" tm_append=[] if len(sys.argv) < 1: …

Member Avatar for Beat_Slayer
0
1K
Member Avatar for DerKleineDude

Hello, I'm a Python/SPSS (DANIWEB) beginner and I'm having a hard time getting classes, functions and methods into the right order. I want to write a script for SPSS where I can read text out of an text object from the SPSS-output file. My code looks like this: [CODE=Python] import …

Member Avatar for DerKleineDude
0
456
Member Avatar for redyugi

[CODE]class Test: def __init__(self, number): self.number = number def getnumber(self): return self.number x = Test(54) y = 'number' print x.getnumber() try: print(eval('%s.%s'% (x, y))) except Exception, e: print(e)[/CODE] This isn't the code I want to fix, but it has the same error. I am trying to return a class function …

Member Avatar for redyugi
0
135
Member Avatar for TrustyTony

I made this program during forum discussion for accessing configuration relative to module directory, not main program's position (which can be accessed by sys.argv[0]'s directoryname). As the thread is closed I post my proves as code snippet.

0
1K
Member Avatar for prashanth s j

Hi, I have got the following requirement: In a file that has many lines, i need to search for a particular line that has the word DTP. The line may be like this in the file: src 172.23.1.23 dst 192.14.2.34 DTP 0 - 65000 If the line with the word …

Member Avatar for Beat_Slayer
0
1K

The End.