15,190 Topics

Member Avatar for
Member Avatar for wulaishiwo

Hi all, In my current project, I need to write python code extracting tons of pages grabbed from the web. By extraction, I mean strip all tags and comments and if possible, filter out small sections like navigation links. The only thing should be left is the length paragraph, if …

Member Avatar for snippsat
0
237
Member Avatar for kishorerp

am working on creating a python script to find Installed programs in Uninstall folder in registry, the script works perfectly fine on 32 bit machines but errors out with a wmi error on 64 bit machines. Am not able to get hold of a wmi module for python on 64 …

0
158
Member Avatar for bumsfeld

This Python snippet shows you how to take typical beginner's example of prime number function and work on improving its speed. The decorator function for timing is ideal tool to follow your progress you make. The improvements are commented and you are encouraged to make further improvements. Python is fun!

Member Avatar for TrustyTony
0
2K
Member Avatar for kur3k

hello, i want use wx.ScrolledWindow() in wx.Dialog() but i dont now how, i use two, three sizer's and nothing ... my code is to long, i search simple example! i must scroll this dialog -> [url]http://www.bankfotek.pl/image/915282.jpeg[/url] thanks

0
56
Member Avatar for magnetpest2k5

Hello all, suppose I have a string which i have retrieved using the regex like the following [CODE] string_feature = '<div class="BVRRLabel BVRRRatingNormalLabel">Customer Rating</div><div class="BVRRLabel BVRRRatingNormalLabel">Value for Price</div> <div class="BVRRLabel BVRRRatingNormalLabel">Picture Quality</div> <div class="BVRRLabel BVRRRatingNormalLabel">Ease of Use</div> <div class="BVRRLabel BVRRRatingNormalLabel">Features</div>' [/CODE] What will be the regular expression to get the …

Member Avatar for snippsat
0
112
Member Avatar for danholding

continued from this thread! [url]http://www.daniweb.com/software-development/python/threads/353210[/url] i have a file which i am currently working on which will remove all pipes and replace them with a comma. that all works fine it the second bit i am currently stuck on.. i need to remove the first two CAPITAL letters from the …

Member Avatar for danholding
0
143
Member Avatar for danholding

please bare with me as im a returning newbie and have not really used re.expression much and still get very confused! my problem! i am currently working on a few database records which need appending. this is one of the files i need to resort the data base has now …

Member Avatar for TrustyTony
0
426
Member Avatar for Swift2

I'm trying to create two for statements,but only one of them runs >.< it's supposed to obfuscate username AND passwords.. Also is there any way to simplify it rather than have two for statements..? The only difference in the second for statement is "Username" and "username" changed to "Password" and …

Member Avatar for Swift2
0
204
Member Avatar for pythonbegin

Hi everyone I am using subprocess module. I called external script by using module subprocess. Now I want to use the output of the external program back in python script. Can anyone help me on this? any good tutorial? I tried doug hellmans ([url]http://blog.doughellmann.com[/url]) blog small example would be great. …

Member Avatar for Gribouillis
0
168
Member Avatar for dustbunny000

I'm writing a code to minimize a function and I'm having problems storing the new move. [CODE]import math import random #minimze the function: def f(x): return math.pow(x,2) + math.sin(10*x) x_list=[] energy_list=[] g=2 #starting position def move(): #Generate a random move random.uniform(-0.5,0.5) def energy(): h=g+move() #generate random move E = f(g)-f(h) …

Member Avatar for Gribouillis
0
101
Member Avatar for zyrus001

Is it possible to read and write to a queue at the same time? for example, one thread is using put() and another thread get() on the same queue? When threading, I've added the task_done() but queue.join() seems to wait for all jobs to finish before the main thread continues.

Member Avatar for Gribouillis
0
118
Member Avatar for bertm81

Hi, I am new to python and am wondering is it possible to name a method after a variable. I know I can name a variable after another variable using [code=python] test = "temp" vars()[test] = 123 print temp [/code] this will print 123. so I was thinking something like …

Member Avatar for bertm81
0
219
Member Avatar for tubesnube

Hi, myself and two of my friends are creating a game that imitates that of Whack-a-mole. I am trying to implement code so that when I click on the mole with the mouse, the image changes to a different image, eg. the image when just moving the mouse is a …

Member Avatar for tubesnube
0
2K
Member Avatar for bpatt22

[CODE] class Player(object): def __init__(self): self.points = 0 def add_points(): plyr1.points += 1 plyr2.points += 1 plyr3.points += 1 if __name__ == '__main__': (plyr1, plyr2, plyr3 = (Player(), Player(), Player()) add_points()[/CODE] How could the 3 lines in add_points() be written better/shorter?

Member Avatar for Gribouillis
0
149
Member Avatar for bertm81

Hey All, am looking for a way to break an xml Tag line into tag and attributes. Say I have This line [code=xml] <event time="12:30" value="This is a Sample Value" type="event"> </event> [/code] I have this so far [code=python] # Open file to read f=open("myTest2.xml") #start reading File for line …

Member Avatar for bertm81
0
202
Member Avatar for saulius

Hi all, after many hours, I decided to ask my question. I'm making an editor for the ABC music notation language. It is not a supported language in the standard wx.stc lexers. It should be possible to add my own lexer, but how do I do it? If it is …

0
43
Member Avatar for kinto

Hey, I have a function, though it's not working as it should be. My program is Dijkstra's algorithm, and I am trying to build a list of a node's nearest neighbours using info contained in a text file of the network (7 nodes in this case), in the form: 0,2,4,1,6,0,0 …

Member Avatar for kinto
0
227
Member Avatar for debasishgang7

Hi all,i can send AT commands to my phone(over Bluetooth) using Hyper Terminal.I am trying to do the same process using python.So here is my code: [CODE]import time import serial # configure the serial connections (the parameters differs on the device you are connecting to) ser = serial.Serial( port='COM8', baudrate=2400, …

0
103
Member Avatar for debasishgang7

I am using python in win32 enviornment.i wanna add extra library for using serial port.So i have downloaded the lib for windows env. The package is installing fine.But when ever i import serial following error i get.Can anyone please help me out... [CODE]>>> import serial Traceback (most recent call last): …

Member Avatar for debasishgang7
0
196
Member Avatar for kur3k

Hello, how i can creat menu in wx.ListCtrl(), for example when i double click in item list, i return menu like for wx.Menu().

Member Avatar for kur3k
0
862
Member Avatar for debasishgang7

hi all, I am trying to make a prog. which will download image from a web site.But the problem is the dynamic nature of the web site. The url is like [url]http://www.site.com/image.aspx?id=445[/url] If i wanna access image 1,2 or anything i can change the id and i can view the …

Member Avatar for debasishgang7
0
459
Member Avatar for prateekmeharia

i am using a template which is working fine with mozilla, but it shows allignment problems with safari, is there any code to make templates cross - browser compatible.

Member Avatar for wulaishiwo
0
85
Member Avatar for progr

I am having problems accessing a variable from one class to another. [CODE] class Player(pygame.sprite.Sprite): def rotateShip(self, rotAmt): radians = self.rotation * math.pi / 180 [/CODE] I am trying to use the variable radians from class Player to another class. radians only exists in 'rotateShip'. Thanks for your help in …

Member Avatar for Gribouillis
0
152
Member Avatar for Vi3tkevin

I everyone, I need help with making a program where the program would allow anyone to type in a certain weight of a package and the output would come out with a pricing. I will attach the detailed instructions to this thread. Help would be appreciated! This is what I …

Member Avatar for TrustyTony
0
140
Member Avatar for weblover

hello all, i'm new to python programming and i'm facing a problem and need ur help i finished my script and i'm trying to execute it on windows cmd the script takes a file as an argument , when i run the script with the argument it works very well …

Member Avatar for weblover
0
405
Member Avatar for pythonbegin

Hi All I have just started using a subprocess.call()to call external commands. I want to call R from command line and that I can do it easily by subprocess.call('Rscript script.R') and it works fine. I want to pass the several arguments instead of using default arguments. I tried using Rscript …

Member Avatar for TrustyTony
0
5K
Member Avatar for Clotoss

I have been working on pygame for awhile, and now I am working on making a fairly complex space ship game. I want the player to be able to go forward with 'w' and steer by rotating the ship with the 'a' and 'd'. I've tried pygame.transform.rotate, but it makes …

0
119
Member Avatar for toritza

hello. I am quite new in python so i have a question. I have a csv file in which i have names of 30 cities and their coordinates(lat and long). i want to generate a distance matrix for these cities. How can i do this ?

Member Avatar for Gribouillis
0
2K
Member Avatar for appsrox

Hello, I want to write to a file in a particular format. There should be 2 columns, the first column should allocate 5 spaces to store digits and the next column should allocate 30 spaces to store characters. Ex:- [code] 1 Dave 234 Einstein 100000 Bob . . . [/code] …

Member Avatar for richieking
0
948
Member Avatar for Python_nooby

Recently I have been learning about the socket module and how you can create networking applications using it. I was curious if it would be possible using the socket module to either: Set the port as a USB port to trick the computer into thinking a USB is plugged in …

Member Avatar for richieking
0
489

The End.