15,179 Topics
| |
I am learning parse command line options by optparse,when I want to parse input file from command line and then use part of it as output file name: [CODE]import optparse parser=optparse.OptionParser() parser.add_option("-input", dest="inputFile") parser.add_option("-output", action="store", dest="outputFile", default=options.inputFile.rstrip(.txt), type="string") (options, args)=parser.parse_args() print "options.inputFile=", options.inputFile print "options.outputFile=", options.outputFile [/CODE] When I call … | |
hello I am new to deniweb and programming.I need your help for my game development i read a programm from your site but i didnot understand anything because i am doing python 3.1.I hope you will help me I want TEXAS HOLD’EM POKER HAND EVALUATOR and i am sending you … | |
ok... so I've decided to start work on a model converter... I'm a lousy Py programmeer and I'm trying to understand a few things... but first off: I want to store vert XYZ data in 'verts' as a list... say we have 3 verts, the var would look like this: … | |
Hi all, I have a problem with QBrush in PyQt. Hi updated my computer and updated pyqt and what used to work doesn't anymore: I have a QBrush and when I try to update the color it doesn't work: brush = QBrush(QColor(255,255,255,255)) print brush.color().getRgb() # output: (255, 255, 255, 255) … | |
This code is giving minimal change from real Python class to JavaMonster with every method having setter and getter not following the PEP8 naming but capitalizedWordsFormat. When instrunctor turns his head or if you put the code in your library, you can simply remove the setter/getter lines. | |
Hey all I am trying to make GUI windows using Tkinter and have got stucked. Its exactly like an installation setup where you move to new windows . I have been unable to understand how to create multiple application windows in Tkinter. I want that according to user input I … | |
Hello, i'm learning object -oriented programming, I was told to create a program that once the class had been designed, to create an object of the class and prompt the user to enter the name, type, and age of his or her pet. The data should be stored in the … | |
I am trying to make a bidding sniper. all functions work so far (bidding, timing, etc), yet I still have to login manually. Would anyone know how I could open a website and then login automaticly from python. Thanks, python01 | |
I need a small tool to print a record layout with a row of data to proof the layout and data match. To that end, I am using a CSV to pick up a record, and a list to store the field names. What I want to do is to … | |
I wrote a little program a while back that changes windows a lot and I was wondering if there is a way to have one window open at the same spot the last window closed? | |
Hi, I run Linux Ubuntu 10.04 and I installed Python 2.7 (didn't uninstall Python 2.6 which is Ubuntu 10.04's default). But I realized later on that I didn't have any practical use for keeping 2.7 anymore seeing that I mostly use 2.6 now. How can I remove Python 2.7? I … | |
Hello, all professionals I aim to create three scripts (one in Host, the other two in 2 different Guests) realizing server vs multi-clients communications. There is a file in my Host system, what I propose to do is transmitting lines in that file to different Guests. Following is the raw … | |
Hi all!!! I have some problems with List comprehension in Python. How can I obtain these two nested list using comprehension? list1 = [[1,2,3],[4,5,6],[7,8,9]] list2 = [[1,0,0],[0,1,0],[0,0,1]] (identity matrix) where list1 and list2 are square matrix of 'n' size thank you in advance!!! | |
Hi guys, I'm trying to learn the principles of artificial intelligence. I just finished coding up a belief net and a corresponding EM algorithm that learns the CPTs for latent nodes using training data (if you're unfamiliar with the lingo, you're probably going :eek: right now). While the program (written … | |
I have a dictionary used a string (read from file by number) as key and a list as its value (each may have different number of elements). I want to print like this: 0 4 2 3 -4 5 3 1 -2 3 4 2 3 11 0 1 When … | |
Im trying to add six functions which are six effects to this tic tac toe game. For instance a remove all pieces function. Also, Im trying to restart the DIE roll after every turn made. If I can get the remove all pieces function(reall) to work I can get other … | |
My daughter plays FaceBook games and is always asking me to solve anagrams. So I thought I would make a script for her to enter a scrambled word and it would compare it to the built-in spell check dictionary. But this code returns words such as quip and quiz when … | |
Hi people I am currently working to traverse a tree and do an inorder printing of the tree. Problem is my instructor wants parenthesis around the expressions not the individual numbers. [CODE] def printexp(tree): sVal="" if tree: sVal='( ' + printexp(tree.getLeft()) sVal=sVal+str(tree.getRootValue()) sVal= sVal+printexp(tree.getRight()) +' )' return sVal[/CODE] That is … | |
This snippet defines 3 functions to create in a few seconds an image of a graph containing arbitrary python objects. It uses the module pygraphviz (available at [url]http://pypi.python.org/pypi/pygraphviz/[/url]). See the example use case at the end of the module. | |
Hello All: I used to be an avid gamer (since I was 7 or 8 years old until recently, and I am now 24). I played anything but my greatest love was turn-based strategy. Games just weren't doing it for me any more - I felt like I could "see … | |
Is there any way to set the maximum size of a ListBox (by pixels)? I know that there is a SetMaxSize but it is not enforced. | |
Hi, I started learning Python 3 around a month ago and I think, I am beginning to get the hang of it. However, I just recently realized that most of the modules I would like to use(wxPython, django,etc) aren't yet ported to Python. SO now, I'm really confused whether I … | |
Hi, I´m wondering how i can append newly created objects to a list by using subclass.I have come this far: [CODE]class Room(object): def __init__(self,name): self.name=str(name) self.hazard = self.empty #def __str__(self): # return self.name def pits(self,antal): pit=1 while pit<antal: assert self.hazard == self.empty self.hazard=self.Pits # return self.hazard def bats(self,antal): bat=1 while … | |
For a project i'm working on now, i need to create a function that is in the format Hours:Minutes: seconds: Fraction where fraction is 1/10th of a second. It should print out every one tenth of a second. I have no idea where to start or how to do this, … | |
write a program that will act as a single user's ATM machine.....the user will have the following menu options 1. deposit 2. withdrawal 3. view account balance 4. exit constraints for validation user can not deposit less tha zero dollars user must withdraw in $10 increments user can not withdraw … | |
i have to use the move method for the ship to move. the distance value is less than or equal to the objects fuel attribute.messgae should be displayed reporting the distance the ship moved and the objects fuel attribute should be reduced by the distance value. if not not enough … | |
Hello, i search widzet for Tkrinter how creat new window ( not Toplevel() ), i want use in this box html thanks ( sorry, my EN is so bad .. ) | |
Based on thread [url]http://www.daniweb.com/forums/thread323401.html[/url], I did this recursive version for comparision. Thanks for posters of the thread! | |
Guys I am trying t write this script that finds the age of a daughter through palindromes. Here is the question: Recently I had a visit with my mom and we realized that the two digits that make up my age when reversed resulted in her age. For example, if … | |
Hi I have a list of False and True, which I have written to a file. When I read the file, I cant get back to my True and False list.... I only get the ["True","False"] version of it, but I want it to be like this: [True,False] Is it … |
The End.