Re: find all multiplicands and multipliers for a number

2015-04-14 Thread Paul Rubin
Steven D'Aprano writes: > primes = sieve [2..] > sieve (p : xs) = p : sieve [x | x <- xs, x `mod` p > 0] > In her paper http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf, Melissa > O'Neill calls this the "Sleight on Eratosthenes". Oh cool, I wrote very similar Haskell code and converted

Re: Working with Access tables and python scripts

2015-04-14 Thread Mark Lawrence
On 15/04/2015 01:47, Emile van Sebille wrote: On 4/14/2015 3:20 PM, accessnew...@gmail.com wrote: > I have an existing extensive python script that I would like > to modify slightly to run a different variation on a process. > > I also have all the variables I need to run this script (about

Re: Working with Access tables and python scripts

2015-04-14 Thread Emile van Sebille
On 4/14/2015 3:20 PM, accessnew...@gmail.com wrote: > I have an existing extensive python script that I would like > to modify slightly to run a different variation on a process. > > I also have all the variables I need to run this script (about > 20 in total)stored in an Access 2010 64 bit datab

Re: A question about numpy

2015-04-14 Thread Paulo da Silva
On 14-04-2015 23:49, Rob Gaddi wrote: > On Tue, 14 Apr 2015 23:41:56 +0100, Paulo da Silva wrote: > >> Supposing I have 2 vectors v1 and v2 and a value (constant) k. >> I want to build a vector r with all values of v1 greater than k and the >> others from v2. >> > > You're looking for numpy.where

Re: A question about numpy

2015-04-14 Thread Rob Gaddi
On Tue, 14 Apr 2015 23:41:56 +0100, Paulo da Silva wrote: > Supposing I have 2 vectors v1 and v2 and a value (constant) k. > I want to build a vector r with all values of v1 greater than k and the > others from v2. > You're looking for numpy.where() . -- Rob Gaddi, Highland Technology -- www.h

Re: Working with Access tables and python scripts

2015-04-14 Thread hey . ho . fredl
I don't know how to start a Python script from Access, but you could definitely do it the other way around, reading the Access database from Python. An example: --- import pyodbc ODBC_DRIVER = '{Microsoft Access Driver (*.mdb)}' connstr = 'DRIVER={0};DBQ={1}'.format(ODBC_DRIVER, 'filename.mdb')

A question about numpy

2015-04-14 Thread Paulo da Silva
I am new to numpy ... Supposing I have 2 vectors v1 and v2 and a value (constant) k. I want to build a vector r with all values of v1 greater than k and the others from v2. I found 2 ways, but not sure if they are the best solution: 1. r1=v1.copy() r2=v2.copy() r1[r1=k]=0 r=r1+r2 2. r=v1*(v1>=k

Working with Access tables and python scripts

2015-04-14 Thread accessnewbie
I have an existing extensive python script that I would like to modify slightly to run a different variation on a process. I also have all the variables I need to run this script (about 20 in total)stored in an Access 2010 64 bit database. Is it possible to create a button on an Access form (o

EuroPython 2015: Call for Proposals has been extended

2015-04-14 Thread M.-A. Lemburg
Since we had Easter holidays and a very busy PyCon US 2015 during the Call for Proposal (CFP) period, the Program work group (WG) has decided to extend the date for the talk submission deadline until: Thursday, 2015-04-28, 23:59:59 CEST Please submit your proposals through the EuroPython w

Re: using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Vincent Davis
On Tue, Apr 14, 2015 at 7:48 AM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > with open(dfile, 'rb') as f: > for line in f: > try: > s = line.decode('utf-8', 'strict') > except UnicodeDecodeError as err: > print(err) > > If you need h

Re: Pickle based workflow - looking for advice

2015-04-14 Thread Chris Angelico
On Wed, Apr 15, 2015 at 12:14 AM, Steven D'Aprano wrote: > On Tue, 14 Apr 2015 11:45 pm, Chris Angelico wrote: > >> On Tue, Apr 14, 2015 at 11:08 PM, Steven D'Aprano >> wrote: >>> On Tue, 14 Apr 2015 05:58 pm, Fabien wrote: >>> On 14.04.2015 06:05, Chris Angelico wrote: > Not sure what y

Re: Using Dictionary

2015-04-14 Thread Pippo
On Tuesday, 14 April 2015 09:54:46 UTC-4, Michiel Overtoom wrote: > On Apr 14, 2015, at 15:34, Pippo wrote: > > > How can I use dictionary to save the following information? > > What a curious question. The purpose of a dictionary is not to save > information, but to store data as a key -> valu

Re: Pickle based workflow - looking for advice

2015-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2015 11:45 pm, Chris Angelico wrote: > On Tue, Apr 14, 2015 at 11:08 PM, Steven D'Aprano > wrote: >> On Tue, 14 Apr 2015 05:58 pm, Fabien wrote: >> >>> On 14.04.2015 06:05, Chris Angelico wrote: Not sure what you mean, here. Any given file will be written by exactly one p

Re: using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2015 11:37 pm, Vincent Davis wrote: >> Which DictReader? Do you mean the one in the csv module? I will assume >> so. >> > yes. > > >> >> # untested >> with open(dfile, 'r', encoding='utf-8', errors='ignore', newline='') as >> f: >> reader = csv.DictReader(f) >> for row in

Re: Pickle based workflow - looking for advice

2015-04-14 Thread Chris Angelico
On Tue, Apr 14, 2015 at 11:08 PM, Steven D'Aprano wrote: > On Tue, 14 Apr 2015 05:58 pm, Fabien wrote: > >> On 14.04.2015 06:05, Chris Angelico wrote: >>> Not sure what you mean, here. Any given file will be written by >>> exactly one process? No possible problem. Multiprocessing within one >>> ap

Re: Using Dictionary

2015-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2015 11:34 pm, Pippo wrote: > How can I use dictionary to save the following information? > > #C[Health] > #P[Information] > #ST[genetic information] > #C[oral | (recorded in (any form | medium))] > #C[Is created or received by] > #A[health care provider | health plan | public heal

Re: Using Dictionary

2015-04-14 Thread Michiel Overtoom
On Apr 14, 2015, at 15:34, Pippo wrote: > How can I use dictionary to save the following information? What a curious question. The purpose of a dictionary is not to save information, but to store data as a key -> value mapping: telbook = {} telbook["jan"] = "0627832873" telbook["ma

Re: Is there functions like the luaL_loadfile and luaL_loadbuffer in lua source to dump the lua scripts in Python's source?

2015-04-14 Thread Chris Angelico
On Tue, Apr 14, 2015 at 11:14 PM, Steven D'Aprano wrote: > For the source code to be dumped, it needs to be Python code (not a built-in > or C extension object), the .py file still needs to be available where > Python can see it (not just the .pyc file), and you need to have read > permission. An

creating a graph out of text

2015-04-14 Thread Pippo
Hi, I am not sure why my code doesn't show the graph. It clearly creates the right nodes and edges but it doesn't show them. Any idea? mport re from Tkinter import * import tkFileDialog import testpattern import networkx as nx import matplotlib.pyplot as plt patternresult =[] nodes = {}

Re: find all multiplicands and multipliers for a number

2015-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2015 12:42 pm, Paul Rubin wrote: > Steven D'Aprano writes: >> http://code.activestate.com/recipes/577821-integer-square-root-function/ > > The methods there are more "mathematical" but probably slower than what > I posted. > > Just for laughs, this prints the first 20 primes usin

Re: using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Vincent Davis
> Which DictReader? Do you mean the one in the csv module? I will assume so. > ​yes.​ > > # untested > with open(dfile, 'r', encoding='utf-8', errors='ignore', newline='') as f: > reader = csv.DictReader(f) > for row in reader: > print(row['fieldname']) > What you have seems to w

Using Dictionary

2015-04-14 Thread Pippo
How can I use dictionary to save the following information? #C[Health] #P[Information] #ST[genetic information] #C[oral | (recorded in (any form | medium))] #C[Is created or received by] #A[health care provider | health plan | public health authority | employer | life insurer | school | universit

Re: find all multiplicands and multipliers for a number

2015-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2015 08:35 pm, Rustom Mody wrote: > On Tuesday, April 14, 2015 at 8:12:17 AM UTC+5:30, Paul Rubin wrote: >> Steven D'Aprano writes: >> > http://code.activestate.com/recipes/577821-integer-square-root-function/ >> >> The methods there are more "mathematical" but probably slower tha

Re: using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2015 10:54 pm, Vincent Davis wrote: > I had been reading in a file like so. (python 3) > with open(dfile, 'rb') as f: > for line in f: > > line > = line.decode('utf-8', 'ignore').split(',') > > How can I ​do accomplish decode('utf-8', 'ignore') when reading with > DictReader

Re: Is there functions like the luaL_loadfile and luaL_loadbuffer in lua source to dump the lua scripts in Python's source?

2015-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2015 10:07 pm, zhihao chen wrote: > HI,I want to dump the python script when some application(android's app) > use the python engine.they embedding python into its app. > *If* the source code is still available, which it may no

Re: using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Michiel Overtoom
> ​How can I ​do accomplish decode('utf-8', 'ignore') when reading with > DictReader() Have you tried using the csv module in conjunction with codecs? There shouldn't be any need to 'ignore' characters. import csv import codecs rs = csv.DictReader(codecs.open(fn, "rbU", "utf8"))

Re: Pickle based workflow - looking for advice

2015-04-14 Thread Steven D'Aprano
On Tue, 14 Apr 2015 05:58 pm, Fabien wrote: > On 14.04.2015 06:05, Chris Angelico wrote: >> Not sure what you mean, here. Any given file will be written by >> exactly one process? No possible problem. Multiprocessing within one >> application doesn't change that. > > yes that's what I meant. Than

using DictReader() with .decode('utf-8', 'ignore')

2015-04-14 Thread Vincent Davis
I had been reading in a file like so. (python 3) with open(dfile, 'rb') as f: for line in f: ​line = line.decode('utf-8', 'ignore').split(',') ​How can I ​do accomplish decode('utf-8', 'ignore') when reading with DictReader() Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/

Re: Is there functions like the luaL_loadfile and luaL_loadbuffer in lua source to dump the lua scripts in Python's source?

2015-04-14 Thread Dave Angel
On 04/14/2015 08:07 AM, zhihao chen wrote: HI,I want to dump the python script when some application(android's app) use the python engine.they embedding python into its app. I can dump the script from an app which use the lua engine through

Re: How To Convert Pdf Files To XML Spreadsheet

2015-04-14 Thread Gene Heskett
On Tuesday 14 April 2015 07:54:58 David H. Lipman wrote: > From: "traciscrouch" > > > A lot will be helped by an effective solution to change PDF to > > workplace > > Once again this project was spammed. > > All users are encouraged to file a complaint with SourceForge. > ab...@sourceforge.net > G

Is there functions like the luaL_loadfile and luaL_loadbuffer in lua source to dump the lua scripts in Python's source?

2015-04-14 Thread zhihao chen
HI,I want to dump the python script when some application(android's app) use the python engine.they embedding python into its app. I can dump the script from an app which use the lua engine through the luaL_loadbuffer or luaL_loadfile (just ho

Re: How To Convert Pdf Files To XML Spreadsheet

2015-04-14 Thread David H. Lipman
From: "traciscrouch" A lot will be helped by an effective solution to change PDF to workplace Once again this project was spammed. All users are encouraged to file a complaint with SourceForge. ab...@sourceforge.net They have also been caught spamming Web Forums. -- Dave Multi-AV Scanning

Re: find all multiplicands and multipliers for a number

2015-04-14 Thread Rustom Mody
On Tuesday, April 14, 2015 at 8:12:17 AM UTC+5:30, Paul Rubin wrote: > Steven D'Aprano writes: > > http://code.activestate.com/recipes/577821-integer-square-root-function/ > > The methods there are more "mathematical" but probably slower than what > I posted. > > Just for laughs, this prints the

How To Convert Pdf Files To XML Spreadsheet

2015-04-14 Thread traciscrouch
A lot will be helped by an effective solution to change PDF to workplace document. For those who have over the casual have to convert PDF to Office records, installing and getting aPDF Converteris a fast and basic strategy. Just a few seconds are installed in by this system. It could convert PDF to

Re: Pickle based workflow - looking for advice

2015-04-14 Thread Fabien
On 14.04.2015 06:05, Chris Angelico wrote: Not sure what you mean, here. Any given file will be written by exactly one process? No possible problem. Multiprocessing within one application doesn't change that. yes that's what I meant. Thanks! -- https://mail.python.org/mailman/listinfo/python-li