15,185 Topics

Member Avatar for
Member Avatar for haojam

Dear Sir, I have written a script to extract the first line starting with [COLOR="Red"]Source Name[/COLOR] AND ends with [COLOR="red"]Comment [ArrayExpress Data Retrieval URI][/COLOR] and i have done it but i could not parse distinct or unique attributes which is not repeated in every files. I would like to parse …

Member Avatar for haojam
0
685
Member Avatar for tachyonshower

hi, i was just wondering if someone could point me in the right direction on how i would go about writing up code for displaying a plane-collection of harmonic oscillators. i would like to display them as oscillating spheres. i have code written up for graphing 1-d coupled oscillators and …

Member Avatar for tachyonshower
0
323
Member Avatar for bretthay93
Member Avatar for longlongsilver

I have to use the function [I]ask_number()[/I] so that is ask the player for a guess with a call to [I]ask_number()[/I] here is my code but it automatically guess the number and i dont know if i did it right [CODE]import random print "\tWelcome to guess my number!" print "nI'm …

Member Avatar for longlongsilver
0
918
Member Avatar for z00t

[COLOR="Red"][U]PYTHON:[/U][/COLOR] I have no idea where to start this, but i need to write code that takes a list of real numbers as input and returns the average of the numbers in the list. any input as to how i would go about starting this code would be much appreciated.

Member Avatar for richieking
0
118
Member Avatar for Asset

How would I write a code to read in this book.txt [CODE]title*Programming PHP author*Lerdorf, Tatroe and MacIntyre publisher*O'Reilly Media description*3 This book covers the PHP programming language. It assumes the reader has some programming experience. It covers connecting to Oracle and MySQL databases. title*Core PHP Programming author*Atkinson publisher*Pearson Education description*3 …

Member Avatar for Asset
0
316
Member Avatar for kuchi

We have a module called "cart.items" and imported this in another PY code to use classes. I did import classed under cart.items like ("from cart.ltems import Items") and used Items class in my code. When I run my PY code in UNIX box, I get that problem. What I ve …

Member Avatar for richieking
0
556
Member Avatar for Thropian

I'm making a little game and I can't get button bindings to work. Here is what I have so far [CODE]def forward(event): print "up" frame.bind("<Up>",forward)[/CODE] but pressing the up arrow does nothing...is there something I missed?

Member Avatar for TrustyTony
0
147
Member Avatar for convoluted

Hello all. I'm trying to get a video feed in a wxPython GUI (under MS Windows) and thought about using OpenCV. There is a short tutorial on how to achieve this at this page: [url]http://opencv.willowgarage.com/wiki/wxpython[/url] (updated late 2009). The problem I'm having is trying to load the libraries to get …

Member Avatar for convoluted
0
379
Member Avatar for TrustyTony

Here another small snippet of mathematical nature returning all possible divisors of number. (set is, by the way, needed because of perfect squares Not possible to edit the snippet part but here the same with less stupid command line interface (not repeating the loop): [CODE]def divides(n): return sorted(set(sum( ([x,n/x] for …

Member Avatar for TrustyTony
1
852
Member Avatar for sneek

Hi, I read the Python/C-API and they say I should not use PyArg_Parse() anymore but use PyArg_ParseTuple(). My problem is that I retrieve an PyObject * out of PyDict_GetItem(...) so this is a single object and not a tuple. PyArgs_Parse() is the only API-Function to get a C-"string" out of …

Member Avatar for Gribouillis
0
2K
Member Avatar for kur3k
Member Avatar for richieking

[B][COLOR="Red"]IS ANYONE INTERESTED IN THIS APP???[/COLOR][/B] I am looking for guys 1 or 2 to write some open source application in python. We will decide what app. we want to write. 1.App in GUI (wx) 2.The app will have its dedicated website. 3. The app in multi platform And other …

0
102
Member Avatar for jgritty

I'm not a huge contributor on these forums, but I do read a lot. Anyhow, I have "completed" a couple things I've been working on in the last couple weeks, and thought I would share. [url]https://bitbucket.org/jgrigonis/mortgagecalculator[/url] A simple mortgage calculator written in python using tkinter that lets you calculate any …

0
73
Member Avatar for singlem1905

[I][CODE]execfile('comp1.py') def exefi(name, locals=None, globals=None): exec compile(open(name).read(), name, 'exec') in locals, globals exefi('comp1.py')[/CODE][/I] it can execute successfully. but [I][CODE]#execfile('comp1.py') def exefi(name, locals=None, globals=None): exec compile(open(name).read(), name, 'exec') in locals, globals exefi('comp1.py')[/CODE][/I] it come with "File "comp1.py", line 39, in <module> ex=c.end() File "comp1.py", line 17, in end return compile(string.join(self.code, "\n"),"<code>","exec") …

Member Avatar for singlem1905
0
117
Member Avatar for Safia Abdalla

I have been working on this simple text editor using Python 3 and Tkinter. This is my first time creating a program with an actual GUI and I have relied only on Tkinter documentation. I managed to create a text editor. However, we I started working on the commands of …

Member Avatar for TrustyTony
0
453
Member Avatar for victordq

Hi guys, Can anyone help me to fix my code so I don't get the unexpected unindent error? The code is very big, so I'll only post a small part so you can help me. I'm using the PyScripter IDE. [CODE]def pegar_dados_serial(): ser = serial.Serial(port='COM4', baudrate=115200, timeout=2) #Rotina para leitura …

Member Avatar for richieking
0
3K
Member Avatar for keltik

Hello, First of all: I'm more used to java, but at university we need to code something in python. I'm having serious problems filling a python-list with values. [CODE] for i in range(self.num_of_players) : self.player_hands[i]=["Testcard"] [/CODE] I want to fill the i-th player_hands-list with a String! Yes i declared a …

Member Avatar for keltik
0
172
Member Avatar for knan

We know that 0.1 + 0.1 + 0.1 - 0.3 = 0.0 But in python 0.1 + 0.1 + 0.1 - 0.3 = 5.5511151231257827e-017 Is there any way I can get 0.0...??

Member Avatar for knan
0
196
Member Avatar for HoneyBadger

Guys I wrote a program that creates 23 random numbers(birthdays) and the counts how many duplicates are there. How come [B][U]sometimes[/U][/B] when I run this it returns "None"? Here is the code: [CODE]import random #Checks for duplicates. def has_duplicates(userstring): userlist = list(userstring) list_len = len(userlist) len_no_duplicates = len(set(userlist)) if list_len …

Member Avatar for richieking
0
98
Member Avatar for Sykee

[CODE] import subprocess import os def main(): quickfile = file_existance() quickdraw = subprocess.Popen(['java', '-jar', quickfile],\ stdin = subprocess.PIPE, \ stdout = subprocess.PIPE) event = WindowEvents(quickdraw) def file_existance(): filename = raw_input("Please enter the location of quickdraw: ") while (not os.path.isfile(filename)): print "That file does not exist, try again" filename = raw_input("Please …

Member Avatar for WildBamaBoy
0
247
Member Avatar for Banjoplucker

Hello, I'm new here, so please be gentle. I have posted my code at the following page: [url]http://www.bpaste.net/show/11397/[/url] In short, I need to read in my file, block by block, but have the re.finditer regular expression report the offsets relative to the beginning of the overall file, rather than relative …

Member Avatar for Banjoplucker
0
106
Member Avatar for tottletj

Basically I've looked everywhere for help with this problem and been unable to find any so i thought i'd ask here. I have a text file full of numbers which i wish to manipulate. the actual text file has about 200 rows and 10 columns, but in this example i'll …

Member Avatar for Gribouillis
1
101
Member Avatar for Archenemie

Ive made this quick program to strip the "youtube - " prefix off my mp3 collection, so i started modifying a script i had made before to replace file names with a <filename><incrementing number> type name. It has gone well so far, with the only problem being it will strip …

Member Avatar for Archenemie
0
2K
Member Avatar for Arbolito

Hey guys. I'm working on a simple hangman program. I got the core engine down working in a command prompt, and now I'm making it using classes and a GUI. I'm using tkinter. Anyway, everything works with no error, but the image is not displaying at all. Here is the …

Member Avatar for KWL
0
1K
Member Avatar for n3red

Hi, I need two functions one that checks if the inputed number is a prime number and second one that splits the given number in to prafactors. I have the first function done but the second one is a bit annoying. The function has to take the given number and …

Member Avatar for TrustyTony
0
481
Member Avatar for wolvo

Hi everyone I have been given a python code to add some functionality in it. The problem am facing is that the original developer has hard coded 3 variables a,b,c in the code and these variables are before class definition in files: hers is the code snippet: [code] a = …

Member Avatar for Gribouillis
0
135
Member Avatar for WildBamaBoy

I know this is probably overly simple but I am terrible with math. This is a section from a game I'm attempting with PyGame. Instead of using pixels for coordinates I have my own render function that uses blocks(actually just cnverts block value to pixels), which are 32x32 pixels, so …

Member Avatar for Gribouillis
0
2K
Member Avatar for DocBreen

[CODE] bif="bg.jpg" mif="ball.png" import pygame, sys from pygame import * pygame.init() screen=pygame.display.set_mode((420,300),0,32) background=pygame.image.load(bif).convert() mouse_c=pygame.image.load(mif).convert_alpha() while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() screen.blit(background, (0,0))[/CODE] [quote=error] Traceback (most recent call last): File "C:/Documents and Settings//Desktop/Programming/PYGAME TEST/pygame.py", line 4, in <module> import pygame, sys File "C:/Documents and Settings//Desktop/Programming/PYGAME …

Member Avatar for IceLee
0
109
Member Avatar for Batric

Hi everyone, I am trying to get Python working on XAMPP. I'm running Windows Vista, XAMPP version 1.7.1., PHP is working without any problems. I followed the instructions from here: [url]http://www.macouno.com/2010/03/17/getti[/url] ... -on-xampp/ I did everything the same, restarted Apache service, rebooted the PC but still I get the following …

Member Avatar for Batric
0
616

The End.