15,185 Topics

Member Avatar for
Member Avatar for c2q

Hi Okay so i have a text file and i have it converted to a bunch of lists with strings as the words. Now i need to find words that occur only once in the entire text file, how can i do this using a loop? A hint says that …

Member Avatar for cghtkh
0
130
Member Avatar for kafro

I'm working with sets and notice when I do: [CODE]s1 = set( ['a', 'b', 'c']) s2 = set([1,2,3]) print s1.symmetric_difference(s2)[/CODE] It prints it off as: [CODE] set(['a', 1, 2, 3, 'c', 'b'])[/CODE] Is there any reason to why it displays it in the order of 'a', 1, 2, 3, 'c', …

Member Avatar for TrustyTony
0
111
Member Avatar for kiddo39

Hi, I've been using tkinter to write a program that has a root window and many toplevel windows. I was able to create them successfully but my next step was to incorporate mysql with it so it would actually store any data that was entered in the various entry fields. …

Member Avatar for TrustyTony
0
1K
Member Avatar for 3FLryan

Hello, I am just starting learning Python and I am having some trouble properly importing a function from a module. I wrote the short script: [CODE]def print_twice(param): print(param, param) [/CODE] When I try to import the function print_twice, the shell tells me it cannot import the name print_twice. When I …

Member Avatar for TrustyTony
0
451
Member Avatar for king_koder

Hello, I got stuck trying to solve the following problem in Python. I understand that I somehow need to implement Dijkstra's algorithm to solve this problem, but how I've no idea. [B]Inside a room, there is a monster with N heads, and a human (with 1 head). The human has …

Member Avatar for slate
0
505
Member Avatar for python01

I am making a program that requires variable values to be sent to the open window (internet explorer browser) I was wondering if there was a way to do this with a module such as SendKeys because IEC python wont install on my pc thanks for the responses, python01

0
46
Member Avatar for pythonlearning

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 …

Member Avatar for woooee
0
81
Member Avatar for jattvelly035

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 …

Member Avatar for woooee
-1
161
Member Avatar for Tcll

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: …

Member Avatar for Tcll
0
803
Member Avatar for pdini

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) …

0
52
Member Avatar for TrustyTony

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.

0
259
Member Avatar for nk28

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 …

Member Avatar for SgtMe
0
795
Member Avatar for pixelss

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 …

Member Avatar for SgtMe
0
904
Member Avatar for python01

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

Member Avatar for python01
0
86
Member Avatar for Tommymac501

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 …

Member Avatar for Tommymac501
0
88
Member Avatar for Thropian

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?

Member Avatar for woooee
0
1K
Member Avatar for ChaosKnight11

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 …

Member Avatar for tlkummell
0
429
Member Avatar for ljjfb

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 …

Member Avatar for ljjfb
0
172
Member Avatar for prexioso

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!!!

Member Avatar for prexioso
0
128
Member Avatar for G-Do

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 …

Member Avatar for Gael Varoquaux
0
330
Member Avatar for pythonlearning

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 …

Member Avatar for pythonlearning
0
147
Member Avatar for Dinnerfortwo

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 …

Member Avatar for Dinnerfortwo
0
450
Member Avatar for txwooley

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 …

Member Avatar for txwooley
0
369
Member Avatar for xtra333

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 …

Member Avatar for TrustyTony
0
304
Member Avatar for Gribouillis

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.

Member Avatar for woooee
1
1K
Member Avatar for 3FLryan

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 …

Member Avatar for 3FLryan
0
183
Member Avatar for winmic

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.

Member Avatar for phunehehe
0
708
Member Avatar for king_koder

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 …

Member Avatar for ultimatebuster
0
663
Member Avatar for 1991

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 …

Member Avatar for 1991
0
7K
Member Avatar for yellowkaiq

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, …

Member Avatar for TrustyTony
0
2K

The End.