15,175 Topics
| |
Hi This is my second post. I am new to python. I hope I have posted my code correctly. I am trying to have Python rewrite the compare.asc file. This file is used with another program called MUST. This is a transmission line program. This program is suppose to compare … | |
I need helping creating a random number of "hello worlds" import random count = 0 while count < 5: count += 1 print "Hello World" dont know where to put the module | |
I usually make a matrix like this [code] from Numeric import * A=zeros([3,3]) print str(A[0,1]) #access an element [/code] I would like to store a pair of values in each element, that is have a matrix where the (0,0) element is (2.3, 2.4), the (0,1) element is (5.6,6.7), etc. Is … | |
[code=python] import random class gameOfLife(object): def __init__(self, columns, rows, grid = []): self.grid = grid self.columns = columns self.rows = rows for i in range(0,self.rows): sub = ['-'] self.grid.append(sub) for sublist in grid: for i in range(0,self.columns-1): cell = ['-'] sublist.append(cell) def printGrid(self): for sublist in self.grid: print sublist def … | |
Hi All, I am developing a GUI in Boa Constructor. I am using a grid for displaying some data and want to change the names of the column and row headers in the grid. Please help me in achieving this. Regards, Dinil | |
[url]http://trac.edgewall.org/[/url] | |
Can I use python to read the contents of a text file on a server and dynamically update text on a web page(based on the text in that file)? This is something that I need to accomplish but I'm not sure if python is capable or if I should be … | |
hi every one. import os from reportlab.pdfgen import canvas from reportlab.lib.units import cm c = canvas.Canvas("/Users/venkatarampey/preview.pdf") c.drawString(8*cm, 28*cm,"HELLO PYTHON") c.showPage() c.save() FILE = open("/Users/venkatarampey/preview.pdf","r") The is the python script for previewing a pdf when run. Problem here is , i was able 2 generate a pdf on mentioned path but … | |
Hi All, I would like to create new rows dynamically. When a user clicks a button, a new row should be added in the grid. Please guide me as to how can I achieve this. Thanks, Dinil | |
Ok, Is there an easy way to do this: I want to take a string and convert it to a binary string with base of my choice and convert it back. So base 2 would be 1's and 0's, etc. example: [CODE=syntax] in_string = "testing" binary_string = string2binary(in_string, base = … | |
Hi all, This is a problem that has been holding me up for a while in Python. I frequently get issues relating to "global ___ is not defined" and cannot figure out what I'm doing wrong. Here is a coin-flip function I wrote: [code] def coinflip(): import random import time … | |
hi, im trying to learn python and this is giving me [ICODE]>>> x=input("Enter a value: ") if x % 2 ==0: print ("even") else: print ("odd")[/ICODE] then when i execute: Enter a number: then i enter a number but it does not print even or odd. why? | |
Hello, I want to total up a variable that changes every time a function is run. [code]import random def flip(): h,t = 0,1 cheads, ctails, = 0,0 cflips = random.choice((0,1)) if cflips == 0: cheads += 1 return 'h' else: ctails += 1 return 't' def repeat(f,n): for i in … | |
Hello, I am trying to write a program that flips a coin until it gets the sequence "heads tails heads" and then stops and says how many flips it took to get that sequence. This is what I have so far: [code]import random import time import string def coinflip(): heads … | |
How do I have the algorithm below to sort my list in opposite direction (right to left) instead of left to right. Also, how do I make it sort simultaneously or alternatively in both directions? Thanks. [code=python] def bubblesort(l): for passes in range(len(l)-1, 0, -1): for index in range(passes): if … | |
Is there anyway to compare lists or check to see how many of the objects in one list are the same as the other list? eg: L1 = [dog, cat, john, moo] L2 = [dog, cow, moo, stuff] there is two of the same "things" in it I'm trying to … | |
Hello, I'm trying to write a coin-flipping program. I can get the program to produce a random coin flip result (represented as either "h" or "t") but I want to add the individual result to an ever expanding string. For example, the first result would be "h" and the big … | |
hi everyone! I have two files, main.py and sprite_class.py. sprite_class.py is in a separate folder called lib. here's a quick diagram: ------------------------------------ /folder engine/ main.py /folder lib/ sprite_class.py ------------------------------------ ...sprite_class.py contains a class called Sprite: [CODE] # sprite class class Sprite(): def __init__( self, start_x, start_y, image_path ): self.x = … | |
| hi again i want to make something that captures images of my window and sove them into either a gif file or a video file, i thought about using win32s [code] win32gui.GetDesktopWindow() [/code] but i wasnt sure how to use this to save it to the file how could i … |
Hi every bod y I am new in programming and I like to start with pyqt but I can not find anything for learning in internet please help me how how can I write program with gt designer & when I make a form in qt how can it work(my … | |
Hello, Im currently writing code for a program that translates a line of text from English into German then back again. Its a big loop that needs to be executed the same number of times as words in the text. I'm almost there but there doesn't seem to be anything … | |
Hey everyone, I'm writing a program with a Tkinter GUI for my job and I was wondering whether there is a way to create an icon on my desktop to start it so I don't have to start Idle and run the program from that (computer un-savvy people will need … | |
Im writing this program that draws a bar graph showing an investment growth. and this error keeps coming up and i cant figure it out. this is the syntax that python keeps telling me. Traceback (most recent call last): File "C:\Python26\lala.py", line 68, in <module> main() File "C:\Python26\lala.py", line 47, … | |
I am embedding Python 3.0.1 on Windows, using MSVC 2008 sp1. I do not pass FILE* structs to Python, so I think compiler version differences is not a problem. The following code has a problem, in that the "txt" string that comes out at the end only contains the character … | |
Hi , Have downloaded a feed from a news site and trying to show only the first paragraph for each story. At present, the output to email looks like this: "http://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=10568455&ref=rss" Man arrested after pointing fake gun at police (A 59-year-old man has been arrested after pointing an imitation gun … | |
So I am trying to create a mirror image that is horizontal. I am having trouble getting the actual image to mirror because I am not sure how to go about doing this. I am using PIL 1.1.6 and Python 2.5.4, if that matters. So far I have: [code=python] def … | |
hello friends........ i need a program which counts the total number of galaxy stars of an image.........i think if the RGB value is less than 50.....then is wont be a star otherwise it will be detected as a star......all the clusters of the stars joined together should be considered as … | |
Hi there, I need to know how to get the hard disk serial number, in windows. Thank you in advance. | |
can anyone of u guyz get me out of da problem m having m sure u guyz can ... i had the python re-captcha thingy to enter the captchas on a website but now tht website has putted some code on the captchas nd re-captcha script is not working someone … | |
I'm trying to use a DLL that I have used many times in other languages including C, Java, Perl, etc so I am pretty familiar with the library, but I didn't write it. It came from a comercial source. I'm using ctyps to load the library as such: [code] from … |
The End.