15,181 Topics
| |
I'm trying to strip HTML tags and replace certain tags with newlines and tabs. I just can't figure out a function to do this, any ideas? I'd prefer to use regex instead of a library. | |
Hey, guys! Newbie here. =) I'm trying to return an image that contains n^2 full size copies of my original image tiled, that makes an n-by-n square. I've been working on this for the past couple days and I am stuck. It's giving me an "image index out of range" … | |
[CODE]area = ((length ** 2) * numSides) / (4 * (math.tan(FULL_ROTATION / (2 * numSides)\ )))[/CODE] this is my thought but I can't figure it out, I always get the wrong value. I need to get my answer in degrees. but even when i use [CODE]return math.degrees(area)[/CODE] at the end … | |
Hi Peepz, My Connect 4 board is made up of different lists. My task is to write a function that checks whether the game ends in a draw (that means when every spot is taken by a 'X' or an 'O' without fulfilling the winning requirements If everyspot is filled … | |
I want to check the input of the user. Only positive nos are allowed. I want to pass the input of the user to a function which checks that if it is i positive no. then it allows the user to continue further otherwise it gives an error and asks … | |
[CODE=Python] def Myfunc(): print "Stuff" #Title: "CrashLanding" #By: Python User #November 16, 2009 #Features improved coding style, or at least I think so #note:code based on J.G.S'S code-I really learned alot from his code Some credit goes to him #note:I dont think that is his actual username so keep that … | |
Hi, I've dabbled in some programming in the past, but nothing serious. I'm trying to create an array of objects in python 2.6 (VPython). What I want to do is create a 2d grid of sphere()'s. But I want to be able to manipulate each one individually after they are … | |
The tkinter tutorial at tkdocs ([url]http://www.tkdocs.com/tutorial/firstexample.html[/url]) shows these two lines at the beginning of every example. [CODE]from tkinter import * from tkinter import ttk[/CODE] Doesn't the first line import everything in the tkinter module? if so, why bother writing the second line? EDIT: Just found an answer (kind of ) … | |
I tried installing pcapy 0.10.4 and i get an error. C:>setup.py install running install running build running build_ext building 'pcapy' extension C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nolog /0x /MD /W3 /GS- /DNDEBUG -DWIN32=1 -Ic:\devel\oss\wpdpack\Include - IC:\Python26\include -IC:\Python26\PC /Tppcapdumper.cc /Fobuild\temp.win32-2.6\Release\pcapdumper.obj pcapdumper.cc pcapdumper.cc(12) : fatal error C1083: Cannot open include … | |
Hi, Hello, I've written a simple Python(2.6) server that I am connecting to through a Binary Socket from an AIR application. I can successfully send text and numbers through, but when I try and send a 3 byte ByteArray through, I receive the ByteArray as a string. More specifically the … | |
Sorry to bother again:) but im new to Python and to OOP. I made a simple sniffer application (thanks to your help) which prints the sniffed data on the console. I want to extend it giving it a GUI using PyQt4. I also made an argument "--nogui" that the user … | |
Hi I'm trying to find a way to find the first avogadro cipher whose digital sum exceeds 100, I've come to: [code=python]#!/usr/bin/python def dig_sum(n): lst = list(str(n)) ln = len(lst) sm = 0 while(i < ln): sm += int(lst[i]) return sm def avo(i,j,k,c): k = j j = i + … | |
I thought I knew how packets worked, but I'm just not understanding how to capture and read them... I am playing this online game which is connected to a server (some server off of battle.net). I want to know how to search my way through the packets and filter them. … | |
I have this program I wrote up and wanted to add signal handler to it. The thing is the example only show how to play with it but no to use in between methods. I tried coding it but it doesnt work [code=python] import sys import signal import operator import … | |
Trying to write a function but don't known how to start. trying to make a function that ask the user for the current population and displays the population after 1/2 years unitil it reaches 1 million at a rate of 8% per year. for example Year 1, population 864000 Year … | |
I have a text file I am trying to manipulate, but the code is very long. I know there is an easy way to do this by looping a few functiions. My code is below but it is not complete. I also have attached one of the text files. There … | |
This snippet defines a context to execute a block of statements in a different working directory (with the help of the with statement). After the block is exited, the initial working directory is restored, even if an exception has occurred in the with block. | |
[B]Bsplayer is a videoplayer. I want to start bsplayer with the parameter -stime-x, where x is the amount of seconds. This result in playing a movie from say 23 minutes 10 seconds with the parameter -stime=1390. The whole thing I can manage to do in [COLOR="Green"][U]DOS[/U][/COLOR] and looks like: @echo … | |
hey this is my first time asking for help. But i am having trouble making this code. (i think i am over looking it) but here is what i need to do. ::: Design and implement a program to maintain a simple income and expense budget for a non-profit organization. … | |
I'm having the hardest time figuring out how my latest homework assignment is supposed to work. Basically we have to write a program that creates a list containing names. The list will then be sorted, written to an output file, and searched. We get the names from a text file … | |
Hi Everyone. I want to use this thread for some help as i'm sure this will not be the only question as i have just over 300 lines of code from my old python 3.1 script. I'm now using 2.6.4 and it is obvious some code isn't backwards compatible. Soooo … | |
Hi guys, I am trying to create a python chat server. So far, it has been going well but a problem has come up with threading. The threading for incoming connections works fine (in the listen_and_accept function). Since I would like to be able to type in commands in the … | |
Hi All, is there a trick in wxPython to skin application to look like this one? What are pros and cons if any? Take a look [URL="http://www.fileguru.com/images/b/audio_recording_studio_multimedia_sound_tools-5778.gif"]Here[/URL] Cheers :) | |
Hi all, Im trying to add tags to my blog post. i did it its done but i wanted more so when users click the link of tag, they will see other post tagged same. anyway here my view_tag function [CODE]def view_tag(request, tag_id): tag = Tag.objects.get(pk=tag_id) news = tag.pnews_set.all() return … | |
The function below is supposed to ask the user to enter a choice of rock paper or sciessors and output an error mesage if the user enters an invalid choice and then ouput a message if they won, drew or lost against the computer. [code] def rockPaperScissors(): import random choice=raw_input("please … | |
Hi Folks the game runs. jippie, but i have a small problem i cant get the board to get drawn from left to right, its drawn from upwards to downwards hope anyone can help me Sincerly elomanias | |
I'M reading the book "Python Programing second edition for the absolute beginner". While explaining the object paramater whithin a class, this how it reads. Base your class on [I]object[/I] , a fundamental, built-in type. Can someone please tell me what that means? Thanks. | |
Does anyone know where I can find a goo pdf python reference for the following? pre built constructors, functions/methods for the follwoing tuples, lists, dicts...etc I hate reading a book with nothing but quick explanation, I want to see them for myself. And I already know how to find them … | |
I'm having trouble understanding why I can't seem to access a dict object of a class once the class instance is referenced through a dict of instances. If that makes sense at all ;) I have a simple class containing only a dict called index. [CODE]class Node: def __init__(self): self.index … | |
I am writing a function that has two parameters F & L and the function returns the sum of the squares of all the intergers between F & L e.g if i call def sum(3,5) should output 50 (9 + 16 + 25) def sum(first,last): sqaure = i for i … |
The End.