15,181 Topics

Member Avatar for
Member Avatar for Garee

Hey guys I have a wee problem I need some help with. How would I read in lines of text one at a time, keeping track of the line numbers, only stopping when a line is read that contains only a single full-stop. Example: It is a briskly blowing wind …

Member Avatar for masterofpuppets
0
102
Member Avatar for biotic.computer

Hi everybody :) i opened a freshly new blog about python and simulation in bioinformatics and i started by programming a DNA Replication,Transcription andTranslation simulator with very simple python commands so is there any improvement to the code source? the Vpython is needed for graphs the blog:[URL="http://bioticcomputer.blogspot.com/"]http://bioticcomputer.blogspot.com/[/URL] the code source:[URL="http://www.slingfile.com/file/ENAI9lK4FM"]http://www.slingfile.com/file/ENAI9lK4FM[/URL] …

Member Avatar for Gribouillis
0
107
Member Avatar for marcux

Hi all! I want to make a subclass of dict and I have read about subclassing and the super method. The problem that I do not get is how I override the following method: [CODE]dict[key] = value[/CODE] This creates a new key with the specified value. I want to override …

Member Avatar for Gribouillis
0
185
Member Avatar for sneekula

I was trying to create a 3x3 list of lists, and came up with this surprising behaviour: [code]# creating a 2D list with an overloaded * operator mlist3 = [[0]*3]*3 print mlist3 # [[0, 0, 0], [0, 0, 0], [0, 0, 0]] mlist3[0][0] = 1 print mlist3 # [[1, 0, …

Member Avatar for Mathhax0r
0
1K
Member Avatar for Musafir

i have to write a program that simulates the flipping of a coin. 1. the function should ask the user how many times the coin should be flipped 2. the program should display the poportion of times that the head and tails appeared. (for example if the user enters 10 …

Member Avatar for vegaseat
0
138
Member Avatar for SoulMazer

Okay, so I am writing a media player and I would like to be able to control the entire thing without the use of a GUI. So...are there any libraries or anything that would allow me to collect keystrokes on any OS (not just Windows)? Thanks in advance.

Member Avatar for Tech B
0
229
Member Avatar for aleezy

For my final project our group is suppose to simulate a game of table tennis this is what we have so far at the bottom. We followed the raquetball game setup for the code but we werent sure how to change this so that when a player scores it doesnt …

Member Avatar for masterofpuppets
0
2K
Member Avatar for lewashby

Please look at the program below as well as my understanding of how it flows and correct me if I'M wrong. Thanks The first line in main - [COLOR="Red"]crit = Critter("Poochie")[/COLOR], creates an object with the string "Poochie" and autmoatically calls [COLOR="Red"]__init__[/COLOR], printing "A new critter has been born!" [COLOR="Red"]__init__ …

Member Avatar for lewashby
0
172
Member Avatar for nizbit

I have a dictionary that I would like to load from a file into a class variable. The dictionary holds configuration data. I would have different files for different configurations. I was wondering if there is a way to do this? I found pickle but that saves an existing instance …

Member Avatar for winmic
0
88
Member Avatar for saikeraku

I'm just trying to create a program that will remove all the trailing whitespace in a text file. (Like all the whitespace after each sentence for the whole text file.) [CODE] n = raw_input("Enter name of file: ") f = file(n, "r") fr = f.read() for fr in f: fr …

Member Avatar for woooee
0
128
Member Avatar for J0kerman

So i want to define a variable with the index of a current step, and then print that variable. For example I have a loop with 10 steps, and i want to define 10 variable: x1, x2, x3....x10 and then print them out: x1=something, x2=something, ......, x10=something.Does anyone know how …

Member Avatar for J0kerman
0
23K
Member Avatar for gangster88

how could i double a number when clicked on in the graphics window?... this is for graphics.py and a line separating the two sides in the graphics window and on each click on either side it must go up by 2 until 12? i can only think of using a …

Member Avatar for jaison2
0
151
Member Avatar for sneek

Hi, may anybody tell me why there is a init AND a new-method? Why not using one constructor-method like we have to use in java and other OO-lanuages?? Would be nice if somebody can give me an idea about that. Thanks a lot Jonny

Member Avatar for sneek
0
177
Member Avatar for deonbannes09

I'm suppose to make a program that uses a Card class to simulate the random dealing of a single Blackjack hand by a Blackjack dealer who follows the standard rules. As it simulates the the single hand, it should randomly draw a new card (by randomly choosing a suit and …

0
37
Member Avatar for lewashby

I have to prgrams and thus, two question to ask. In the following program how does the line [COLOR="Red"]status = staticmethod(status)[/COLOR] do anything? My python programming book somehow connects it to the line [COLOR="Red"]Critter.total +=[/COLOR] 1 but I don't see how? Please explain. [CODE]# Classy Critter # Demonstrates class attributes …

Member Avatar for vegaseat
0
191
Member Avatar for ffs82defxp

i recently found that variables set in a function cannot be used in another function. so to make variables 'universal' i have to make them global variables? and you do that buy stating them global, like this? [CODE]global [VARIABLE NAME]=[VALUE][/CODE] i have a feeling there is more to it.

Member Avatar for vegaseat
0
378
Member Avatar for ffs82defxp

is there a command or fuction in python that deals with email? like: [CODE]email(ibmceo@ibm.com, 'Hello, my name is Bill. How are you doing at IBM?', email.cc(),attach("C:\123321.txt"))[/CODE] :D

Member Avatar for vegaseat
0
83
Member Avatar for jaison2

I need help with the function but i have no clue how to?.. the function should generate a random number between 1 and 100 and then allow the user to guess the number. After each guess it should display if the guess is too high or low and if they …

Member Avatar for snippsat
0
206
Member Avatar for NicholasE

Dear members, I need to write a small loop to generate the following: 0 0 0 0 .... 0 1 1 1 .... 1 2 2 .... 2 3 .... 3 4 : 299 I think it needs a double loop but since i am still beginner in python i …

Member Avatar for NicholasE
0
109
Member Avatar for ffs82defxp

simple simple grrr [CODE]import math import time while 1: r = input("Enter Circle Radius --> ") circ = (pow(r,2)) * 3.14 print '' print 'The circumferance of a circle with a radius of ',r,'is',circ,'.' print '' time.sleep(2) print '' print '' print '' print "Loop Start or Exit? 'l' or …

Member Avatar for masterofpuppets
0
116
Member Avatar for SoulMazer

So, I have a script that needs to "clean up" when it is exited: it needs to clear a special logging file and other small things that affect the next startup of the script. The script has a GUI written in Tkinter, if that is relevant at all. Is there …

Member Avatar for SoulMazer
0
100
Member Avatar for willygstyle

Hello all, I have been trying for a few days now and done quite a bit of reasearch on the internet and this website to find out how I can authenicate to a website. It could very well be that this particualar web server is picky I'm not to sure. …

Member Avatar for willygstyle
0
182
Member Avatar for coffeebox

I am beginning to work on the GUI for a project I have been working on for several weeks now. I would like the application to end up being cross platform, and I prefer not to have to manually code the whole GUI so I decided to work with BoaC …

0
46
Member Avatar for MRWIGGLES

Hi, I'm having trouble just printing particular strings out of a sentence. <h1>hi my name is</h1> if i just want the program to print out <h1> </h1> and ignoring the text in between, how would i do that? i have tried converting everything to ascii and printing within the range, …

Member Avatar for MRWIGGLES
0
92
Member Avatar for vsagarmb

i am not able to figure out why python throws an error when i call this function. In the code snippet below when i call set_greyLevel() python throws an error. If i comment the function call it works fine. Please help. Thanks in advance. [code=python] def set_greyLevel(self, grayScale): if grayScale …

Member Avatar for willygstyle
0
163
Member Avatar for maomaohui

i got some homework for a program in python [CODE]''' Function that haven't been achieved. ============================================ Maxium Number. No number bigger than 2147483648 or less than -2147483648; Proper 'd' function - Accept the result or only input. - Proper 'd' substitution calculate. .Gets the function of '=' .Has it's own …

Member Avatar for Ene Uran
-2
72
Member Avatar for roshini.johri

hey i am a beginner as far as python is concerned..i am having diff in understanding this code..i am supp to do it in python..if anyone can tell me wht it does it wud be really helpful [code] for qid,query in "as2.qrys": for word in query: docs = set(index[word]) for …

Member Avatar for Ene Uran
0
133
Member Avatar for gangster88

how could i call the above function so that when i input something like 21 for the mark the ouput is "the grade is A", and when the user inputs something more than 25 and less than 0 hes asked to input it again..? [code] def mark2Grade(mark): if mark >=20: …

Member Avatar for gangster88
0
115
Member Avatar for paat

Hi, I'm trying to get last inserted row id from cursor object but no luck. Any Ideas? [CODE] import pgdb conn = pgdb.connect(None, 'postgres', None, '10.58.5.50', 'dpd') cursor = conn.cursor() cursor.execute("INSERT INTO ops.tbl_returnlist (rname) VALUES ('Test')") conn.commit() print cursor.lastrowid [/CODE] Outputs None

0
35
Member Avatar for ShadyTyrant

I am working on a library database module ([URL="http://www.daniweb.com/forums/thread241506.html"]See this thread[/URL]). I want to implement a custom error class. [CODE=Python] class LibraryError(Exception): def __init__(self, value): self.parameter = value def __str__(self): return repr(self.parameter) [/CODE] This class needs to handle errors such as sql execute errors, and be able to check for …

Member Avatar for ShadyTyrant
0
85

The End.