14,952 Topics
| |
Can anybody tell me how can i avoid the overflow of this program? from math import sqrt f=lambda n: sum([int(i)*int(i) for i in str(n)]) L=[] for n in range(0,10**20): if sqrt(f(n))%1==0:# == float(int(sqrt(f(n)))): L.append(n) L.sort() print "NĂºmero de quadrados perfeitos na lista:",len(L) print L y= lambda L: reduce(lambda x,y: x+y,L) … | |
Hi all, This is the beginning of a hopefully useful project: to create a Canvas widget for wxPython that will mimic or improve on the Tkinter Canvas widget. Those of you who have coded with both will probably know what I'm talking about. With Tkinter, you can plop items like … | |
Hi folks, I believe this is a simple task, but I'm having problems getting things to work the way I would expect them to. What I have is a master file containing about 1000 lines. Each line looks like this: 2008_06_01 07:55 24.8 83.1 What I need to do is … | |
Hi I was create a form in Qt Designer and saved as UR.ui (main title of this forms is "MainWindow") next write in terminal: pyqt4 UR.ui > UR.py and open created file UR.py and write: import sys from PyQt4 import QtCore, QtGui from UR import Ui_MainWindow class StartQT4(QtGui.QMainWindow): def __init__(self, … | |
hi everybody..... i'm using an array to make a program but i'm not able to find the size (length) of the array.can anyone tell me how to do this? | |
I have a .txt log file and must of it is crap. But there are parts that display when a user logs in, and at what time the logged in. Below is a portion of the log file. For example, "user1" is a user logging in and "user2" is another … | |
So, here's the deal. I am making a pretty simple program, but I seem to have a major problem. I have a loop in the code that is supposed to keep executing a command until the user presses a button. The problem is, I cannot figure out what I should … | |
If i have an audio file that is in .py format how do I play it? | |
Dear all, this is my first post on the Forum, so hello everybody! :) I am newby with Python (I have only 4 days experience), I have started to leanr because I will need to develop some software to the company I working in. Currently I am developing a code … | |
Hey guys. I have to create an alarm clock in python. i really really need some help in creating this thing.. seeing that i have absolutely no clue what i am doing. I have found some basic code that supposedly makes a clock which updates but the bleeeding thing just … | |
hi everyone....... i am writing a program where i have 2 ovals and i want my first oval to appear then after 2 seconds the second one...but am failing in doing this. can anyone help me to do this please. thank you in advance here is my code [ICODE] from … | |
Hi guys, I have a friend at school and she's taken Unix 2. She gave me a copy of her work assignment so that I could improve my scripting skills (Still a begginner at python and programming). This is the assignment: Write a script that will prompt the user to … | |
Hi, I am new to python and new to this forum. So how are you all? What I am trying to do is create a script editor, with syntax highlight and unicdoe support. It doesnt need to link to ANY compiler, it simply have to display my script with highlights, … | |
I am working to increment lists in such a way that each item in the list is incremented incrementally, it sounds confusing but its not: If the user inputs: [CODE]list = [1, 2, 3, 4] [/CODE] I want the output to be: [CODE]2, 4, 6, 8[/CODE] in essence, the first … | |
does anybody knows why this function doesn´t work very well: f=lambda n: reduce(lambda x,y:x**2+y**2, map(int,str(n))) I want that this function add the square of the digits of a number an example of what i want: f(442)=4**2+4**2+2**2=36 and it's giving me f(442)=1028!!!:S However fou numbers with 2 digits the function works! | |
I have a string that loks like "u'mystring'". i'm wondering if ther is a easy way to remove the u'' part of the string? | |
[B] Have someone ever implement game of life without using cell??? just using a plain interface like tkinter and rectangle. [/B] | |
Hi Guys, I have a nested dictionary that i would like to be populated from a file at the start of my prog and put back into the file at the end of the prog. Could anyone direct me to somewhere where i could get info on how to do … | |
Hi, I am using Python 2.4.4 and: from numpy import * from MA import * I am using masked data in arrays and functions: average, min and max. When the last item of an array is masked, I am getting "masked" results for min and max functions, even if there … | |
Hi All, Currently Iam writing python ftp script to upload a file to FTP Server. The server where iam going to download a file expects the upload command in this format "put <filename> flash" I dont know how to send this same command in ftp session after login. I have … | |
Well I got past most of the problems with my boxlets application. I wanted to hear what people think of the functionality and if they have any input/suggestions. Known issues: * When you already have applications open, their boxlets pile up on top of each other. Remember, this software requires … | |
I have a server with access to 9 different IP addresses that I want to use for different purposes and I wish to keep them separated. I am going to be doing my work using UrlLib2, is there a way I can specify which IP address I am using through … | |
I am trying to manipulate user input strings using the ord() funtion. This effectively allows me to identify the decimal value of each character in the string. I have been able to return the value of the characters, but what I need to understand is how to store each value … | |
Hey guys, sorry for this, what im sure is simple, but i just cant get it! i have a dictionary for restaurants.. then i have nested dictionaries holding information like when these restaurants open and close. [CODE] Restaurants = { 'Italian' : {"OpenTime" : "11:30", "CloseTime" : "20:30"}, 'Mexican' : … | |
Hi All, I am very much new to python.I need an application to generate password protected pdf. Can anyone help me out? Thanx in advance Dushyant Joshi | |
Hi, I've got about 10 functions that all share a bit of code. They all look something like this: [code=python] def func(arg): statement1 statement2 statement3 unique code statement4 statement5 [/code] Each function does similar statements at the beginning and end, but has unique stuff in the middle. Is there a … | |
Hi, My problem is that I have a large function with hundreds of lines. I want to break it apart into smaller functions. The issue is that if I make a module level function, the scope changes and I have to pass the necessary variables to it. This can be … | |
Hi I'm new in python and i'm do not understand why my code is not working. I want to generated random figures with this code: import random import division a1 = '' a2 = '' def zufallsZahl(a1,a2): a1 = random.randint(1,10) a2 = random.randint(1,10) print a1, a2 s1 = [a1, a2] … | |
what is the best language-related python library, with support for spell checking (aspell?)? | |
Hi all, I added a new script to the code snippets page. This time, it's a logic puzzle called "Petals Around the Rose." The goal is for you to infer what algorithm is being used to "score" rolls of five colored dice without peeking at the code. The snippet is … |
The End.