15,179 Topics

Member Avatar for
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
906
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
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 jlm699
0
106
Member Avatar for lrh9

I know that certain functions will check the script's or module's current directory for the file if no path is specified. [code=PYTHON]open('test.txt')[/code] If that script is run and test.txt is in the same directory that will open the correct file. However, if I try to import that module it doesn't …

Member Avatar for lrh9
0
2K
Member Avatar for ryufire
Member Avatar for prashanth s j

Hi, I have got a utility "sock" which is C executable (under linux) on my machine. It acts like a server or client based on the arguments passed at the command line. I want to run it through a python script. I am using the subprocess call function to execute …

Member Avatar for prashanth s j
0
200
Member Avatar for sureronald

I wrote a python program that gets input from an input file. It works fine for small input files since after opening the file I did this to get the data [code=python] data=fPtr.readlines() [/code] Since readlines only takes the input data and packs it into a list, it is clear …

Member Avatar for mahesham
0
4K
Member Avatar for gangster88

I would like to be ablt to display 25 circles with alternating colours of red and white? But the code I produced does not work.. plz help. from graphics import * w = 300 h = 300 win = GraphWin("Red Circle", w, h) center = Point(150, 150) radius = 80 …

Member Avatar for Beat_Slayer
0
2K

The End.