15,175 Topics

Member Avatar for
Member Avatar for kur3k
0
58
Member Avatar for JeffOwens

So I have some code that basically takes a file given with 4 points taken from a rotoscoped scene and spits out an output of information in the form of a list Original File Format Frame 1(Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s)) Frame 2(Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s)) Frame 3(Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s)) Frame 4(Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s)) Frame 5(Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s)) Frame 6(Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s),Point(x,y,z,w,s)) Output ============ Frame …

Member Avatar for TrustyTony
0
125
Member Avatar for TrustyTony

What does this print statement produce and why? Learned it today, I still must be a newbie. [CODE]print('%0*d' % (3, 7))[/CODE]

Member Avatar for Purkinje
1
192
Member Avatar for patto78

I want to install the dateutil module to work with Python 3.1. I didn't get very far through this installation however before I was advised that I also needed to install setuptools. I've tried to do this using the commands given below, but am not having any success. [CODE][/CODE]$ tar …

Member Avatar for TrustyTony
0
187
Member Avatar for Alex9385

Hi, I would like to select rows from a 2D numpy array according to a condition. I would like to get a 2D results array directly without the need of the costly np.reshape statement. Does anybody know how to assemble array b more efficiently? Thanks, Alexander [CODE]>>> a = np.array([[0, …

Member Avatar for TrustyTony
0
171
Member Avatar for kaellee

#!/usr/bin/env python from socket import * import time import sys import select import threading import Queue _name_='_main_' loop=2 def client1_chat(connection1,connection2,i): while 1: data1=connection1.recv(1024) if data1=='end': end1=data1 connection1.close() connection2.send('%s' % data1) break else: connection2.send('%s' % data1) def client2_chat(connection2,connection1,i): while 1: data2=connection2.recv(1024) if data2=='end': end2=data2 connection2.close() connection1.send('%s' % data2) break else: connection1.send('%s' …

0
69
Member Avatar for halien

Hi all, I am trying to write a list of complex numbers to a csv file. The list looks like: [QUOTE] cpl1 = [(-6.4703169037894082e-12-2.7429131015110908e-12j), (-9.0688415110840026e-11+1.7513018812920222e-11j), (-1.8522787470498514e-10+1.3074128585310874e-11j), (-5.8563154325952382e-10-6.4430377699764563e-10j), (2.1451734832922398e-10-9.987741744765799e-10j), (2.9095870157647141e-10-6.3227384439201728e-10j), (1.9448214150230569e-09+5.1612969453884716e-10j)] [/QUOTE] The complex numbers are to be written to file to look like: [QUOTE] real, imaginary, real, imaginary, real, imaginary, …

Member Avatar for bvdet
0
272
Member Avatar for shasta90

[url]http://www.daniweb.com/software-development/python/threads/187060/1572491#post1572491[/url] based on a previous thread I would like to know how to replicate the appearance of a house five times on the gasp interface via the script below: #!/usr/bin/env python from gasp import * # import everything from the gasp library begin_graphics(title="Houses At Night", background=color.BLACK) # open the graphics …

Member Avatar for ~s.o.s~
0
1K
Member Avatar for Simplicity.

Hi all, This code solves the Euler Equation of Gas Dynamics which is a system of partial differential equations. The problem is that it takes very long to run than it would normally required. Things become worse after including the functions "S_p(a_p,a,b)" and "S_m(a_p,a,b)" which are called within other functions …

Member Avatar for Simplicity.
0
154
Member Avatar for Gribouillis

A functor, or function object is sometimes a convenient way to encapsulate helper functions and data needed to achieve a small task, and also to share data between calls to the same function. This snippet defines a base class [b]functor[/b] which permits an easy functor creation for python 2.

Member Avatar for TrustyTony
2
710
Member Avatar for blivori

Hi, I created a Python script using pyPDF that automatically merges all the PDFs in a folder and puts them into an output folder and rename them automatically as per the folder's name. What I want to do now is for the script to search for sub-directories, process all the …

Member Avatar for blivori
0
223
Member Avatar for [V]

Here is my scenario: I have a bunch of data points, each of which shares homology with another. Basically A -> B A ->D B -> C C -> A .:. C ->D, etc... given a bunch of these relations, I need someway to graphically represent these relationships. I picture …

Member Avatar for TrustyTony
0
174
Member Avatar for Russ775

My issue with this code is that when it is executed it does loop correctly. It just runs once and my goal is to have it run 100 times. I am using Python version 3.1 and could really use some help... Considering I am the only geek with in a …

Member Avatar for JoshuaBurleson
0
114
Member Avatar for Russ775

[CODE]import random print("\t\tWant to know your future?") input() fortune = random.randint(1, 5) if fortune == 1: print("You are gonna die today") input() elif fortune == 2: print("You will find love") input() elif fortune == 3: print("You will make it big today!") input() elif fortune == 4: print("You friends will betray …

Member Avatar for JoshuaBurleson
0
184
Member Avatar for heavy.is.happy

Hi. I have an issue who i can't solve. The problem is that a = "13.33" and I want it to turn a = 13.33 and not 13.3333333333 and not 13.330000002. So, how do i make it so "13.33" will be an 13.33 float?

Member Avatar for Gribouillis
0
129
Member Avatar for TrustyTony

Inspired by Computer Science forum post, I did this code. I prepared it Shedskin compatible, and it runs quite nicely indeed. Even interpreted the algorithm is faster than full sort. Here interpreted test for the module, shedskinning this test would show better time for sort solution. Python version has benefit …

Member Avatar for TrustyTony
0
368
Member Avatar for Pyprogrammer

how do you make the python script run when the computer realizes that the flash drive is there when is not in your computer....I'm making a internet boost program and its on a flash drive but i don't want to have to navigate to start it...Thanks

Member Avatar for Purkinje
-1
100
Member Avatar for shibunath
Member Avatar for Purkinje
0
2K
Member Avatar for noobprogrammer

Hi everyone, i was given a book.xml file which contains all the title,author of the books. Here's how it looks like. <?xml version="1.0" ?> <Books> <Item> <BookID>A001</BookID> <Title>A Tale of Two Cities</Title> <Author>Charles Dickens</Author> <Language>English</Language> <Year>1859</Year> <Quantity>5</Quantity> </Item> <Item> <BookID>A002</BookID> <Title>The Lord of the Rings</Title> <Author>J. R. R. Tolkien</Author> <Language>English</Language> …

Member Avatar for Gribouillis
0
148
Member Avatar for noobprogrammer

Hi everyone here, Can someone please guide me in transforming XML-to-SQL output with Python? I need to create 2 tables (Books and Patrons) into SQL. How much i suppose to start with??? <?xml version="1.0" ?> <Books> <Item> <BookID>A001</BookID> <Title>A Tale of Two Cities</Title> <Author>Charles Dickens</Author> <Language>English</Language> <Year>1859</Year> <Quantity>5</Quantity> </Item> <Item> …

0
72
Member Avatar for DragonSlayerX

[CODE]from gasp import * begin_graphics() Circle((200, 200), 60) Line((100, 400), (580, 200)) Box((400, 350), 120, 100) update_when('key_pressed') end_graphics() [/CODE]

Member Avatar for DragonSlayerX
0
101
Member Avatar for JoshuaBurleson

I am having issues finding a way to have the below program search for any given string of "query" in the keys of the dictionary AB and return the value, or the key and value. Thus far I just done what I have preset in the dictionary; Ashley and Joshua, …

Member Avatar for JoshuaBurleson
0
280
Member Avatar for fonzali

hi guys , I rented a gps from the airport and it had no problem giving me the directions , while using it , I kept wondering how it picks the routes , and can python be used to program these devices and how ? a short code would be …

Member Avatar for fonzali
0
91
Member Avatar for lrh9

I'm working on a project where I would like to compare collections of words, but I have additional constraints I need to account for. The collections are like a set in that order doesn't matter for the comparison. However, in my problem equal elements are significant. E.g. the collection of …

Member Avatar for TrustyTony
0
140
Member Avatar for [V]

I am trying to use a the re.sub() method. I have a string which I backreference with '\\1'. In my substitution parameter, is there anyway I can pass \\1 through a function? For example [CODE] output = re.sub(r'blah blah blah(\d+)','\\SOME_FUNCTION(\\1)',string) [/CODE] where any instance of (\d+) will replaced by the …

Member Avatar for Gribouillis
0
93
Member Avatar for miac09

Hi, I have posted an example code to report overlaps between segments in two lists based on their start and end coordinates. The problem is that the while loop is breaking after 'True' and won't iterate through the lists. So, in the example lists it will only return (True, 0, …

Member Avatar for TrustyTony
-1
226
Member Avatar for Purkinje

I have a question about function-based decorators. When I make the first call to sqrt(), I enter the decorator function, which I understand. However, every subsequent call to sqrt() only calls the temp_func, not the actual decorator again. I thought decorators were called every time the method is called, but …

Member Avatar for Purkinje
0
191
Member Avatar for elieobeid7

i had some problem with python so i tried to fix it and now i can't use pypm to install anything, see this picture [url]http://s1201.photobucket.com/albums/bb354/elieobeid7/?action=view&current=er.jpg[/url] can you fix it? I'm using activepython 2.7

Member Avatar for elieobeid7
0
94
Member Avatar for iwant2learn
0
110
Member Avatar for jfarny

Hello all, I created a simple game using the pygame and livewires packages a few years ago on a windows PC. Since then my pc died on me :( and I've switched over to a mac. I decided I wanted to dust off my old game, make some modifications, and …

0
85

The End.