15,181 Topics

Member Avatar for
Member Avatar for sravan953

Hey guys, I have made a program called 'tLapse', here's the code: [code='python'] import subprocess import time import os print("Welcome to tLapse...") time.sleep(3) os.system('cls') try: com=open("action.txt",'r').read() condition=True except: print("File error") raw_input("<Any key to quit>") condition=False if(condition): clock=raw_input("Enter time duration after which\nuser-specifiedaction will be\npeformed.\n\nFormat- [hh:mm][24- hour format]: ") def app(path): ext=path[-3:] …

Member Avatar for sravan953
0
135
Member Avatar for richnimbix

I'm a newbie to python. After opening a file in 'r' mode then using the approach below. f = open( '/g.txt','r') for line in f: I find a pattern I'm looking for in a text file. Then I use f.tell() to record the file position. However, I think due to …

Member Avatar for woooee
0
76
Member Avatar for squallgoh

Hi all. I'm new to the forum, this is my first post =) I'm trying to create a list containing 3^10 lists, each list has 10 string. Each string can be of 1 or 3 types, for simplicity let them be 'a', 'b','c'. So basically I wish to generate all …

Member Avatar for squallgoh
0
138
Member Avatar for Stefano Mtangoo

Its long now I try to understand wxPython's print frame work. Every effort have fallen apart. I just cannot understand how it works. I have tried to google with no avail. wxDemo is too painful to swallow :( I request anyone familiar with framework to give me a jump start …

0
52
Member Avatar for mahela007

I'm trying to develop a simple script that will keep the scores of a cricket match. In my script I want the __init__ method on one class to create an object of another class. here's an example. [code=python] class Person: def __init__(self,name): self.name = name class clubMember: def __init__(self,name): New_clubmember …

Member Avatar for vegaseat
0
197
Member Avatar for foosion

Why does this make sense in 3.1? [code]>>> a = b'\x01\x02' >>> a[0] 1 >>> a[0:1] b'\x01' >>> a[0] == a[0:1] False >>> a = '\x01\x02' >>> a[0] '\x01' >>> a[0:1] '\x01' >>> a[0] == a[0:1] True[/code] Shouldn't we get True for both comparisons?

Member Avatar for foosion
0
201
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
341
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
386
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
782
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

The End.