15,175 Topics

Member Avatar for
Member Avatar for pwolf

How to return the sum of the last digits of the values in a list? i cant think of an efficient way. If it wasn't for being in a list i could do it, but im really lost. Can anyone advise me? im going to look for a way in …

Member Avatar for pwolf
0
4K
Member Avatar for Lingson

hi, i've tried to search any examples to understand more about how to use the urllib in python 3.1, but all the tutorials are for python 2.x i need to do just a simple thing like getting the text (as string) and manipulate it. the code in python 2.x would …

Member Avatar for Rocketdlib
0
2K
Member Avatar for pwolf

Create a function generateNumbers(num) that takes in a positive number as argument and returns a list of number from 0 to that number inclusive. Note: The function range(5) will return a list of number [0, 1, 2, 3, 4]. Examples [CODE] >>> generateNumber(1) [0, 1] >>> generateNumber(10) [0, 1, 2, …

Member Avatar for TrustyTony
0
2K
Member Avatar for apeiron27

my list looks like this: [(nStart, nEnd, nName),(nStart, nEnd, nName)...and so on] how do i sort first based on nStart, then on nEnd? thanks:)

Member Avatar for TrustyTony
0
58
Member Avatar for pwolf

the objective is to create a function to determine, from the three sides of a triangle, whether it is isosceles or not. I wrote the following code, yet its not very efficient, how could i have done this better? and is there anything wrong with this code? i tested it …

Member Avatar for TrustyTony
0
3K
Member Avatar for Joelx

I need to copy a certain line from a text document, this I have done by using a "key-word" in the document. My problem now is that I also want to copy the entire line below this specific line. Help is much appreciated as I am new with programming FILE …

Member Avatar for Joelx
0
178
Member Avatar for hisan

Hi All, i want to know how to calculate number of sub String available with in a string in python

Member Avatar for snippsat
0
154
Member Avatar for monkl

I am trying to get a program to return a coord that increases or decreases in either X or Y given an input of either X, -X, Y, or -Y. It starts at (0 , 0). When I run it however, it always returns (0 , 0). What am I …

Member Avatar for woooee
0
221
Member Avatar for WolfShield

Hey guys, I actually have two questions here. I've made a splitter window with two panels and set the min size to '200'. But how do I make one panel not be allowed to re-size to larger than '200'? And the second question is: if I wanted to put a …

0
86
Member Avatar for Ismatus3

hello friends , i just need to test the Cx_freeze , i have in a folder /home/user/Bureau/testexe/ two files : Hello.py , its code is : [CODE]#!/usr/bin/python # -*- coding: utf-8 -*- myfile = open('testexe.text','a') print >> myfile, "Hello" myfile.close()[/CODE] and a second file : makeexe.py which contain : [CODE]#makeexe.py …

Member Avatar for telmo96
0
242
Member Avatar for pwolf

""" Write a function to convert temperature from Celsius to Fahrenheit scale. oC to oF Conversion: Multipy by 9, then divide by 5, then add 32. Examples >>> Cel2Fah(28.0) '82.40' >>> Cel2Fah(0.00) '32.00' """ so it says, but i couldn't think of an a way to do so efficiently. But …

Member Avatar for TrustyTony
0
1K
Member Avatar for neti1987

I wrote a program which gets a number n ( > 0) and prints all the numbers with n digits. [CODE] def Q(n, index = 0, list = []): if (index == n): print list return startFrom = 0 if (index == 0 and n > 1): startFrom = 1 …

Member Avatar for woooee
0
4K
Member Avatar for TrustyTony

Inspired by discussion in [url]http://www.daniweb.com/tutorials/tutorial238544.html[/url] (test cases are from there) I used my magic pattern matching function transformed from numbers and adding the parts length checking loop. I like my own solution better, I do not know about you.

Member Avatar for TrustyTony
0
2K
Member Avatar for Sinnocence

( old ) sql = """CREATE TABLE (DATABASE1) ( TEXT_BODY CHAR(20) NOT NULL)""" I would like the above to work like the below. [CODE] sql = """CREATE TABLE ('%s') ( TEXT_BODY CHAR(20) NOT NULL)""" % header [/CODE] ( this produces an error ) Does anyone know how I can make …

Member Avatar for StephNicolaou
0
61
Member Avatar for adrain91

[CODE]import urllib.request import sys #'http://www.imdb.com/list/SuSZdwCyHzU/' def savePage(urll,filename): with urllib.request.urlopen(urll)as url: page=url.read() # print(page) sys.argv[0]=filename outfile=open(sys.argv[0],'w') for line in page: outfile.write(line) outfile.close() savePage('http://www.imdb.com/list/SuSZdwCyHzU/','outIMDB.txt')[/CODE] so here is my code .I try to write the original codes into the 'outIMDB.text' but somehow I got this bug: File "C:\Program Files (x86)\Wing IDE 101 4.0\src\debug\tserver\_sandbox.py", …

Member Avatar for richieking
0
434
Member Avatar for pwolf

the scenario is a fitness test and the challenge was to return a string saying either Gold, Silver, Pass or Fail, depending on certain conditions, they were as follows; gold - the candidate scored 4 or more at each station , and had a total of 13 or more points …

Member Avatar for woooee
0
237
Member Avatar for John_Cro

Hello, people I only registered here for this matter (although it is a great forum). I am a ph.d. student and need to investigate eigenvector centrality measure for my homework. I found Phyton code on net and would like to see does it produce the same results as mine, written …

Member Avatar for Gribouillis
0
257
Member Avatar for Gribouillis

This snippet defines a decorator @mixedmethod similar to @classmethod, which allows the method to access the calling instance when it exists. The decorated functions have two implicit arguments [i]self, cls[/i], the former having a None value when there is no instance in the call. Using python's descriptor protocol, the implementation …

Member Avatar for TrustyTony
1
414
Member Avatar for Valex

Please help me! I have to make dictionary in py tkinter and i don't know how to do definition this is my code: from Tkinter import * j=("slo", "ang", "nem") def pretvori(): if(b.get()==j[0] and c.get()==j[1]): slo_v_ang() if(b.get()==j[0] and c.get()==j[2]): slo_v_nem() if(b.get()==j[1] and c.get()==j[0]): ang_v_slo() if(b.get()==j[1] and c.get()==j[2]): ang_v_nem() if(b.get()==j[2] and …

Member Avatar for Valex
0
2K
Member Avatar for debasishgang7

Hi all, I wanna extract a certain link from a web page using python regular expression. The scenario is like this.. The code: blah... ... .... <div class="test" src="[B][url]http://www.test.com/file.ext[/url][/B]" style="top:0px;width:100%;" .... blah blah blah I wanna extract the url "http://www.test.com/file.ext" from the page using python regular expression. Thanks in advance!

Member Avatar for snippsat
0
281
Member Avatar for moroccanplaya

hi created a simple python program that reads the source code of a url and stores into a variable then saves the sourcecode into a file on the computer but the problem that i have that is when python reads the sourcecode it stores it all in one line in …

Member Avatar for moroccanplaya
0
84
Member Avatar for iraj.jelo

hi friends , how to create a popup emoticon widget for a chat client? i found this source : [URL="http://bit.ly/wMZyTQ"]http://bit.ly/wMZyTQ[/URL] , but function reinit() is a bit complicated, can anyoune help me to simplify it? or does anyone have any good idea?

0
64
Member Avatar for iraj.jelo

Hi my friends , i have written a program that in client section in error occures frequntly , i think the error comes from socket function in client . what i have to do? [code] # This is my server code , this code has not problem import asyncore import …

Member Avatar for Gribouillis
0
3K
Member Avatar for apeiron27

[CODE] for i in file: if i == 0: break else: y = i[0] for k in gile: ~~~~ break [/CODE] if i write something like this, which line does the program read after the second break? thanks

Member Avatar for zeroliken
0
82
Member Avatar for telmo96

I'm trying to compile the following pygame code: [CODE]import sys, pygame pygame.init() size = width, height = 320, 240 speed = [2, 2] black = 0, 0, 0 screen = pygame.display.set_mode(size) ball = pygame.image.load("ball.gif") ballrect = ball.get_rect() while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() ballrect = …

0
51
Member Avatar for sun_2588

Hello everyone....... i need to display the html and php page on the tkinter window...is that possible to create a frame or canvas, which work as a php html interpreter.......... to fetch html i can use urllib module, i think... Thanks ....

Member Avatar for sun_2588
0
144
Member Avatar for Cupidvogel

Hi, I was wondering if Perl has a command line interpreter like Python's IDLE, where you can test things readily without having to save them as a program and run them. If not, why? Why is it that Python or Matlab has command line interpreters where you can type 4+3 …

Member Avatar for d5e5
0
309
Member Avatar for draven07

...hello!!!...I need some help in python... ..Im new to Python programming and I need a window form builder that can script it into a python program....can you please give me suggestions.???..I have tried also searching on google but Im afraid the results might not help me well....unlike asking here at …

Member Avatar for vegaseat
0
2K
Member Avatar for pwolf

i finally started having a look at gui yesterday, and tried to do some things with PySide, however i have the following problem; Whats wrong with this code? [CODE] !/usr/bin/python # -*- coding: utf-8 -*- import sys from PySide.QtCore import * from PySide.QtGui import * class Form(QDialog): def __init__(self, parent=None): …

Member Avatar for snippsat
0
295
Member Avatar for Cenchrus

Hey guys, I'm looking for a python library that can. 1. Act as a simple paint editor. 2. calculate top, bottom, left, right most points of a picture I'm trying to make a simple handwriting recognition software based on the number of permutations possible for simple endpoints. Example: psudocode for …

0
121

The End.