15,406 Topics
![]() | |
Sorry for this post... Problem solved... had nothing to do with classes | |
What is the best way to terminate ReadFile once the data is done being read? I just sits there an hangs! I'm kinda new to Python so be easy on me! :) The other way i was able to read info from my pipe was blah = open(pipe) then blah.read() … | |
[CODE]dict = {'ENSTRUT00000047813': '1680', 'ENSTRUT00000047812': '2067', 'ENSTRUT00000047811': '2067', 'ENSTRUT00000047810': '2088', 'ENSTRUT00000047814': '738', 'ENSTRUT00000047808': '2208', 'ENSTRUT00000047809': '2001'}[/CODE] I want to find out the key with max value from the dict I am using the [CODE] protein = max(dict.iteritems(),key=operator.itemgetter(1))[0][/CODE] but it will give me results as [CODE]'ENSTRUT00000047814'[/CODE] though i know that it … | |
Can anyone please help me as i am new to python, i have a requirement for a cascaded menu(which should be dynamically built). The cascaded menu should have new at all levels and when the user clicks on new it should ask for keyword and when done it should add … | |
hi i need help to write two different functions the first one is to displaysquareroots that asks the user for a number n, and displays the square roots of the number from 1 to n and to 3dp so if the user enters 3 it displays the square root of … | |
Hi, I have been ask to do this: Write a function wallOfEyes that takes three parameters (radius, width and height) and displays, in a window of exactly the right size, a “wall” of brown eyes of the given radius and dimensions. E.g., the function call wallOfEyes(50, 4, 2) should give … | |
I have recently made a guessing game code and I am now trying to make it so when you enter a number above 3, it will give a print command that i will write. I don't need help on the print command, I just need to know what the string … | |
So im putting together a program that decompositions numbers on prefactors. Example: 252=2^2 3^2 7^1 and 1944=2^3 3^5 Put this into tuples: (wont use split, just for example) >>> split(252) [(2, 2), (3, 2), (7, 1)] >>> split(1944) [(2, 3), (3, 5)] This is the code that determines whether a … | |
Hello everyone, I'm new to this website and to prgramming in general. Taking a class and we're starting with python. Doin a programming project in which I need to do Data mining for a company. I'm stuck trying to get the company's monthly average for each month. I can A … | |
Greetings, I'm working my way through Michael Dawson's Python Programming for the Absolute Beginner book. At the end of chapter 4: "for Loops, Strings and Tuples", there is a challenge that asks so "improve Word Jumble so that each word is paired with a hint. The player should be able … | |
Hi there, I am in a first year programming class at Dalhousie University (Halifax, Nova Socita, Canada), and I need a little help with an assignment. The exercise is as follows: "[10 Points] Create a number guessing game. First, ask the user for some positive integer, n. Ask the user … | |
Hi, I have a date with the String like "20091128' and we have to check this date with current date ("20101118"). if that date is old then we need to do some rules. I've checked in google whether there any existance but there have different formats. Can anyone give me … | |
Hi, im newish to python and have been stuck on this coding for a few days I have managed to code so I take input from user of a string which I then list the string depending on how many strings are entered after a space so if the input … | |
This is basically what I have. I've commented out all the places where I know what to do, but not how to do it. PEG_HOLE = 10 PEGGED = "X" ##################### # Functions you need to fill out def roll_die(): # This function will simulate rolling two six sided dice … | |
I'm writing a program for a class that's a game. It has ten places to put a peg, numbered 1-10. You have to roll 2 die and the summation is the number you have to work with to try and fill in the board. So far, my program is as … | |
I need help converting this problem into a python program. I've been at it for days and its due tomorrow. Someone please help! In a locker room there are 1,000 lockers in a row numbered from 1 to 1,000. They are all closed. A monkey comes in and starting at … | |
Hi Droopy doesn't work on my Linux's distro with python 3.1 (with python 2.x everything was ok). (here you can find droopy [url]http://stackp.online.fr/?p=28[/url]) I've used this command 2to3 -w droopy and changed alot u" in " , in Translations section But now there is another problem [CODE] Traceback (most recent … | |
I just started to learn gui with wxpython I can see many objects have a style attribute, for example TextCtrl, self.inputArea = wx.TextCtrl(self.background, style=wx.TE_PROCESS_ENTER) Where can I see a list of available style for each object? Thanks | |
Hi all, I am in the process of automating functional tests. I have the following requirement. 1. The python script should invoke the Lauterbach automatically 2. The cmm file mentioned in the python script, should be loaded in to the Lauterbach automatically. Is there any commands to do it? Please … | |
Hi all, I am having problem printing chinese character in a text file. Some point to know: 1. I do not know the codec of the text file, but I know it is writting in traditional chinese. 2. I tried some approach from google, no one work I don't remember … | |
[code]> can't invoke "event" command: application has been destroyed while executing "event generate $w <<ThemeChanged>>" (procedure "ttk::ThemeChanged" line 6) invoked from within "ttk::ThemeChanged"[/code] Has anyone ever seen this error before? It keeps appearing when I load a toolkit I need for my project. I've been working to find out where … | |
Hi guys, I'm new to forum and to Python. I need some help with the python - MySQL interaction. I'm creating a program for my conclusion project in College and it's not working. I gotta present it on Wed, 11/24, and I'm really desperate for some help. It's suposed to … | |
Hey all, Hopefully this will help someone with a problem I encountered. For a few days now I was looking for a way to concisely set the attributes to numerous controls without duplicating attribute code again and again. For example, let's say I have 3 static text controls and I … | |
I created 2 classes and I need to pass Name, Dept., Birthdate and HireDate from the Employee class to the Date class. I get the month date and year from input prompts. The problem I have is how to get those dates for the employee passed into the date class. … | |
So I've been writing this application that works with files , and I wanted to add a list of recently opened files in the "File" menu and I came across a weird bug .. Here's the sample code .. [code] for path in recentFilesList: item = wx.MenuItem(menu, wx.NewId(), path) self.Bind(wx.EVT_MENU, … | |
Hi, How can I print this figure if I have an array like this? It should be a for-loop but don´t know how. [CODE] labyrinth = \ [[0,0,0,0,0,0,1,0], [0,1,0,1,1,1,1,0], [0,1,1,1,0,1,0,0], [0,1,0,0,0,0,0,0], [0,1,1,0,1,1,1,0], [0,0,1,1,1,0,0,0], [0,1,1,0,1,1,1,0], [0,1,0,0,0,0,0,0]] [/CODE] figure: ############. ## ## ##. . . . ## ##. . . ## #### … | |
Please help! I need to write a programe, that would draw a picture like this: [URL="http://yfrog.com/6ptreelj"]http://yfrog.com/6ptreelj[/URL] I've tried with recoursion but it doesn't work properly. from turtle import * [CODE]tree(n, lenght): if n == 0: lt(90) fd(lenght) rt(45) fd(lenght/2) bk(lenght/2) lt(90) fd(lenght/2) bk(lenght/2) rt(45) else: rt(135) tree(n-1, lenght/2)[/CODE] | |
Hi How can I delete a file after a certain time? for example if I want to delete a file after 08.30 has passed? do I use import OS? and import time? | |
I have no clue how to start this Use the for and while iterative structures within Python to program a loop that generates a list of odd numbers from 1 to 33 inclusive. (two sets of code here!) | |
python.org tell people to forget about python 2 and head into python 3, but many 3rd party module do not support python 3 at all. For example, python 3 only ship with a tkinter gui module which does not have great reputation. If I am to use python 3, I … | |
Hi, this is my first post here at Daniweb. Seems like an active and friendly environment. I have very limited experience with programming in general, and even more so with GUI programming. As the title suggests, I want to stop a while loop by the use of buttons. When I … | |
Hey guys! This is my very first post on this website. Anyways, I just started learning Python, and am reading an ebook, called "A Byte Of Python". So at the end, it says to create an address book application. In my application, it basically just creates a text file with … | |
Hey DW. I'm trying to figure out a way so my TCP Server and client can seamlessly send messages back and forth without having to take turns sending the message. Python isn't my language of choice but it's the one i have to use for this assessment. I'm also using … | |
I've learn python and I won't say that I know it all, but I won't see anywhere except google will use python. New programming language like python and ruby, do they have space to grow? | |
This snippet defines a function to merge sorted iterables containing similar items into a single iterable. Items are supposed to be sorted in ascending order. Only one item per iterable is stored at a time. | |
python code to create a Class called Car for automobile objects. The class constructor a color attribute. Be sure to include a constructor with the color parameter. The constructor should include a message that a Car of the appropriate color has been created. here is my code: [CODE]class Car(object): """A … | |
im trying to edit this class so it takes a letter grade instead of a number to find the gpa but im at a total loss any ideas? [code]class Student: def __init__(self, name, hours, qpoints): self.name = name self.hours = float(hours) self.qpoints = float(qpoints) def getName(self,name): #name=input("what is the students … | |
I'm trying to search a specified range of numbers and I'm currently using regular expressions. The lines I'm searching contain numbers from 00 to 30, but I only want to find the lines containing 02 to 22. I have tried a few different things, but none of them work. this … | |
Hello! (I would like to use tkinter. ) I'm going to do my program who convert roman letters to arabic numbers and vise versa. I'm going to do two buttons and a textfield where you can write in the number or letters and then choose if you want it transelate … | |
Hi, im trying to figure out how to call a function's variable from here [CODE]def legal_moves(board): moves = [] for square in range(DINNER): if board [square] == SPACE: moves.append(square) return moves[/CODE] I want to take the variable moves and use it for main How would I do that? | |
[CODE]ENSTRUG00000000009 ENSTRUT00000000011 1026 509 5896 ENSTRUG00000000011 ENSTRUT00000000014 420 63 482 ENSTRUG00000000012 ENSTRUT00000000015 10902 15313 93157 ENSTRUG00000000012 ENSTRUT00000000016 2844 23243 60985 [/CODE] as this is my input file it has five coloumns and there is for each line , we have to identify unique entry from the first coloumns which high … | |
I did an accidental overwrite of the pre-instealled Python framework in the System directory of my Mac running OSX 10.5.9. From the official Python website: "The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are … | |
Hi all, I am trying to update the colour of a Tkinter label, so as the value of a variable changes so to does the colour of the text. Below is a simple example of what I am trying to achieve, but the problem is when I press the button … | |
Hi, I am having some trouble writing this code. The question is as follows: The Sieve of Erastophenes is an algorithm -- known to ancient greeks -- that finds all prime numbers up to a given number n. It does this by first creating a list L from 2 to … | |
Hello all, I've been stumbling (more like Stumbling, I hope) across the web looking for something that can do occasional screen captures using a cron job on my casual gaming site server. I was hoping to be able to save screen captures of a few characters as I leveled them … | |
Srpn is a reverse polish notation calculator with the extra feature that all arithmetic is saturated (i.e. when it reaches the maximum value that can be stored in a variable, it stays at the maximum rather than wrapping around). Program must be able to input at least two numbers and … | |
[CODE]def work(here): variabel = "Hi" x1.here(variabel)[/CODE] How can I make here as a local parameter? that will work for calling other functions? | |
hi, I try to write a app to automatically re-organize my mails (thunderbird). The first thing I try is to re-create my folders tree, once for each year. So i need to read mbox files and rewrite them [CODE=python] import mailbox mbx=mailbox.mbox("./in_mbox") mbx.lock() of=open("out_mbox", "w") for k, m in mbx.iteritems(): … | |
hi all, i just doing Django..tried the first example in Django book...i encountered problem at admin page. it says that admin is not defined. i followed each step in tutorial and i am able to run django server also. pls help me to solve it. i am adding error output … | |
hey, I don't know if you have seen my other post or not, but I have been working on a small code lately to get the users credentials such as their password and username. As you can see, the code gives a warning and says there is a problem with … |
The End.