15,175 Topics

Member Avatar for
Member Avatar for febinameer
Member Avatar for betatype

I am trying to replace a section of code within a series of php files. I open the files, read the contents into a "sourcecode" variable and locate a section of code. I then capture this section in a variable like this: [code=python]phpsection=sourcecode[phpstart+2:phpend][/code] The problem is after I locate this …

Member Avatar for foosion
0
82
Member Avatar for nomemory

Hello, I am a python newbie and I am trying to accommodate to the basics. What's the python equivalent for the following Java snippet ? [B]Java:[/B] [CODE]public class Main { public static void main(String args[]){ int a,b,c; a= (int) (Math.random()*100); c=0; while((b=(int)(Math.random()*100))!=a){ c+=1; } System.out.println(c); } }[/CODE] I was trying …

Member Avatar for woooee
1
215
Member Avatar for patto78

Hi, the following project is the first small step in an anagram solver that I am coding. I have four letters "a", "b", "c", "d" and the aim of the following code is to produce all possible permutations of these letters, given that the first letter is always "a". (I …

Member Avatar for patto78
0
138
Member Avatar for alex-VX

this is a software that you ill have to login ells i will shut-down i used the threading so the Tk gui.would keep on going but it wont stop after 0. its not a problem its just iterating me knowing its in the background. so is there any way to …

Member Avatar for alex-VX
0
203
Member Avatar for nunos

Hello. I have a (main) list of objects 'feedbacks' which have an 'order_id' and a 'message'. I have another list of simply 'order_id's whose correspondent object in the main list I would like to see removed. For example: main list: [object type 'feedback', object type 'feedback', object type 'feedback'] let's …

Member Avatar for nunos
0
338
Member Avatar for miac09

Hi all, I'm learning python and hope someone can help me with a sort of tricky search/parse problem. I have a tab deliminited file like this: 2 1 863.8 300.2 0.0131 0.0759 0.1727 0.0879 1.5821 3 1 874.5 289.5 0.0574 0.1292 0.4447 0.2258 1.1846 3 2 874.5 289.5 0.0573 0.0527 …

Member Avatar for jice
0
155
Member Avatar for sravan953

Hey guys, I am making a program called 'Weather Watch' which basically gets weather updates for any city you type in. For now, it only gets info for a particular city. I don't know how to search for the term entered in [url]www.weather.com[/url] and then get the updates. The code …

Member Avatar for EAnder
0
385
Member Avatar for Friktion

Hey everybody im currently rewriting my game from an engine into opengl and pygame and im not sure how to use opengl with pygame here is what i have done so far =) [CODE=python] from sys import path,exit,argv ; path += ['.'] import wave, pymedia.audio.sound as sound from OpenGL.GL import …

Member Avatar for Friktion
0
202
Member Avatar for sravan953

Hey guys, I have some code: [code='python'] import urllib2 as url import subprocess import os webs=open("url.txt",'r') read_webs=webs.read() def get_html(): try: req=url.urlopen(read_webs) res=req.read() return True except: print("<Error reading from the website>") def get_command(): if True: for x in res: if(x!='<'): command+=x else: break determine() command="" def determine(): format=command[len(command)-3:] print format get_html() …

Member Avatar for sravan953
0
154
Member Avatar for jonte

Hi, I´m new to Python and right now I´m trying to learn to parse a text. Here is my code (that doesn´t work the way I want) [CODE]text = ['Mary', 'went', 'out', 'at', '7pm', 'to','buy','some','candy'] keyPerson = ['Mary', 'Clark', 'Steven'] keyTime = ['7pm', '6am', '2pm'] keyThing =['candy','eggs','fruit'] list = [] …

Member Avatar for jonte
0
75
Member Avatar for Gribouillis

When several producer threads put items in a queue.Queue, and a consumer thread gets items from the queue, there is no way for the consumer thread to tell the producers that they should stop feeding the queue. This snippet defines a subclass of Queue with a close method. After the …

Member Avatar for Gribouillis
0
316
Member Avatar for jocose

I am trying to figure out the best way to deploy a python script that I wrote. Many of the users wont have python on their machines but might want to make slight alterations to the script. What I was thinking about doing was using Py2exe to compile a script …

Member Avatar for sravan953
0
148
Member Avatar for bobbysox

Hi, I'm new to python, but I want to start learning :) I just wondered if anyone could tell me how to use a variable from a function outside the function?

Member Avatar for sravan953
0
84
Member Avatar for sandeep.m

Hi please help me to install libxml2-2.7.1 and libxslt-1.1.24.tar.gz fot python 2.5.2. When i try to install libxml2-2.7.1, i gets installed but when i import the libxml2 in python interpreter then i get the following error: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "libxml2.py", line …

Member Avatar for woooee
0
416
Member Avatar for catcit

Hello! I need to create a progress bar and up to this our this class [URL="http://code.activestate.com/recipes/492230/#clast"]http://code.activestate.com/recipes/492230/#clast[/URL] is the best class that fits my needs. I posted my problem at comments. Thanks, Danci Emanuel

Member Avatar for vegaseat
0
560
Member Avatar for sandeep.m

Hi, I have installed "MySQL-python-1.2.2" in my CentOS 5.3 server using "python setup.py install" command. It is giving me the error as : Traceback (most recent call last): File "setup.py", line 5, in <module> import ez_setup; ez_setup.use_setuptools() File "/home/installars/MySQL-python-1.2.2/ez_setup.py", line 85, in use_setuptools import setuptools; setuptools.bootstrap_install_from = egg zipimport.ZipImportError: can't …

0
47
Member Avatar for nunos

Hi all. I would like to be able to parse some data from a password protected site. The parsing of the data is already developed and tested (I manually logged in to the site and downloaded the source code for testing purposes). I am stuck at the log in part. …

Member Avatar for nunos
0
245
Member Avatar for AutoPython

Okay, so, my main problem here, is that I can't get my parameters from my function name to work with the other variables from the function. Here's the code: [CODE] def next_block(x): p1 = 2 p2 = 2.3 p3 = "c" p4 = "String" p5 = "3.4444" return p1, p2, …

Member Avatar for Gribouillis
0
130
Member Avatar for AutoPython

Okay, I'm done with making a lot of threads with nooby quesions. Those were just some things in the back of my mind. But that's not the point. Here's a program that generates a random 8 character string. It consists of letters A-Z, a-z, and 1-9. There's 767,544,201,216 possible combinations. …

Member Avatar for AutoPython
0
245
Member Avatar for matMalo

Hi guys, I've a problem calling a 'parent' PyQt4 method from inside an object that inerits it. Here is the code: [ICODE] import sys from PyQt4 import QtCore, QtGui class ItiaQPushButton(QtGui.QPushButton): def __init__(self, txt): super(ItiaQPushButton, self).__init__("Hello") print super(ItiaQPushButton, self).__doc__ #QtGui.QPushButton.setText("BO") def setText2(self, txt): self.setText(txt) #super(ItiaQPushButton, self).setText("PROVA") class Window(QtGui.QWidget): def __init__(self, …

Member Avatar for Gribouillis
0
149
Member Avatar for frank.zappa

Is it possible to run a .py file on a computer that doesn't have Python installed? I'm asking this because I was messing around with py2exe and noticed that every time I built an executable, it would create a 'python26.dll' along with some other files. I was wondering, if I …

Member Avatar for sravan953
0
775
Member Avatar for AutoPython

Okay, I have yet another question that I could not find.I noticed that you can't set variables in for loops without having to do something (like in batch). I've tried googling it and doing a site search, I have gotten no results. So what would the code or command be …

Member Avatar for AutoPython
0
103
Member Avatar for shawnisalk

I'm trying to open a usb webcam via Python. Can anyone give me a hint how to do that? Thanks, Shawn

Member Avatar for Salem
0
167
Member Avatar for mahela007

Hi.. I would like to know how to create a variable while the program is being executed. Here's what should happen. The program asks for an input from the user and then creates a variable who's name is the value of the input and then assign's a value to it. …

Member Avatar for The_Kernel
0
256
Member Avatar for computerfreak97

Can anyone give me an example on how to use fft to see weather there is a certain frequency above a certain amplitude in the microphones current sample(s).

Member Avatar for Gribouillis
0
96
Member Avatar for awa

Hi, I want to make a python program which allows to read data from a file starting from a line with a certain keyword, skipping 4 lines, beginning to write the contents to an output file and stopping after n lines. I tried so far an input with the re.search() …

Member Avatar for awa
0
148
Member Avatar for lllllIllIlllI

Hi guys, I have been programming in python for just a bit over 2 years now. Being quite apt at it i was wondering, what can you do to really extend yourself in python? We have a lovely thread in the Projects for Beginners, but in some ways i have …

Member Avatar for lllllIllIlllI
0
212
Member Avatar for AutoPython

I'm making a program that shuffles a specific code. Each letter and number has a specific variable represeting them such as code1, code2, code3 etc. So lets say 1 is sait to code1, 2 to code 2, 3 to code3 etc. So here's what I've done, I've put the all …

Member Avatar for AutoPython
0
112
Member Avatar for Stefano Mtangoo

Hi all, I want to implement print option on my program. For now I need to print ListCtrl. I'm doing google process and I posted here in case someone happens to know and is willing to help me, whether with code or advice. Appreciate

0
49

The End.