15,175 Topics
| |
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 … | |
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 … | |
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, … | |
| 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:) |
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 … | |
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 … | |
Hi All, i want to know how to calculate number of sub String available with in a string in python | |
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 … | |
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 … | |
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 … | |
""" 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 … | |
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 … | |
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. | |
( 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 … | |
[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", … | |
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 … | |
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 … | |
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 … | |
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 … | |
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! | |
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 … | |
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? | |
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 … | |
| [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 |
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 = … | |
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 .... | |
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 … | |
...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 … | |
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): … | |
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 … |
The End.