Re: If you were starting a project with XML datasource using python

2015-01-05 Thread Steve Hayes
On Mon, 5 Jan 2015 03:54:06 -0800 (PST), flebber wrote: Hi I need some advice on managing data in the form of xml. I will have to repeatedly import a small xml file but with many complex attributes. If I want to retain data integrity and keep the import process simple and querying from the stor

Re: If you were starting a project with XML datasource using python

2015-01-05 Thread George Silva
As people already said, don't use XML for persistence. Read it, parse it, and persist it in another format. databases are quite good for that. even sqlite3 will outperfom any few MB xml files. On Mon, Jan 5, 2015 at 11:55 PM, Chris Angelico wrote: > On Tue, Jan 6, 2015 at 11:49 AM, Dennis Lee B

Re: If you were starting a project with XML datasource using python

2015-01-05 Thread Chris Angelico
On Tue, Jan 6, 2015 at 11:49 AM, Dennis Lee Bieber wrote: >>So you would convert it to json so it can then be stored? >> > NO! > > JSON and XML, in my mind, are equivalents -- (human-readable) > notations > for transferring data between applications. JSON may just have fewer > "op

Re: Help with map python 2

2015-01-05 Thread Steven D'Aprano
Terry Reedy wrote: > On 1/5/2015 6:33 AM, flebber wrote: >> >>> You could do what mathematicians do when they deal with alternating >>> signs: they raise -1 to the power of the index to get an appropriate >>> multiplier. >>> >>> >>> [ n * (-1) ** n for n in range(10) ] >>> [0, -1, 2, -3, 4

Re: problem with for and if

2015-01-05 Thread Steven D'Aprano
Dariusz Mysior wrote: > I want search count of szukana in zmienna but code below counting all 12 > letters from "traktorzysta" word > > szukana="t" > zmienna="traktorzysta" > > > def gen(): > count=int(0) > for a in zmienna: > if szukana in zmienna: > count+=1 >

Re: Help with map python 2

2015-01-05 Thread Terry Reedy
On 1/5/2015 6:33 AM, flebber wrote: You could do what mathematicians do when they deal with alternating signs: they raise -1 to the power of the index to get an appropriate multiplier. >>> [ n * (-1) ** n for n in range(10) ] [0, -1, 2, -3, 4, -5, 6, -7, 8, -9] Mathematicians operati

Re: If you were starting a project with XML datasource using python

2015-01-05 Thread Dan Stromberg
On Mon, Jan 5, 2015 at 3:54 AM, flebber wrote: > Hi > > I need some advice on managing data in the form of xml. I will have to > repeatedly import a small xml file but with many complex attributes. If I have a choice, I choose JSON over XML. If stuck with XML, I like xmltodict: https://pypi.pyt

Re: toStringList in PyQt5

2015-01-05 Thread Chris Angelico
On Tue, Jan 6, 2015 at 5:04 AM, Suhail Mahmood wrote: >self.recentFiles = settings.value("RecentFiles").toStringList() >AttributeError: 'NoneType' object has no attribute 'toStringList' This sounds to me like your RecentFiles setting doesn't exist yet. You could try a two-step

Re: need some guidance on Python syntax smart editor for use with speech recognition

2015-01-05 Thread Chris Angelico
On Tue, Jan 6, 2015 at 5:18 AM, Eric S. Johansson wrote: > Is there any problem with keeping the conversation going here or would you > prefer some other way of talking about it? I've been hesitant to put my work > up on github because it's flailing about with also the bloody loose ends > because

Re: need some guidance on Python syntax smart editor for use with speech recognition

2015-01-05 Thread Jacob Kruger
Eric, not really related, but, from the blind perspective, some of the end-users would also love to be able to define their own sets of voice commands, and have something like a personal assistant app handle that for them, instead of having to necessarily work with PC in normal ways all the tim

Re: which specified python module can monitor text information in Windows GUI

2015-01-05 Thread vern . muhr
On Monday, January 5, 2015 4:06:52 AM UTC-8, Chambers yin wrote: > Which kind of specified python module can monitor text in Windows GUI or > support the similar function? > > > Br, > -Chambers Sikuli (http://www.sikuli.org/) might be helpful. It is scripted in Jython. Not quite a "standard" m

Re: If you were starting a project with XML datasource using python

2015-01-05 Thread flebber
> > >If you were starting a project, it relied on XML as its datasource what > >would you use and why? And have you used it or just speculating? > > > If I were starting a project, I'd argue furiously that XML is NOT > something that should be used for dynamic data storage (the original GRA

Re: need some guidance on Python syntax smart editor for use with speech recognition

2015-01-05 Thread Eric S. Johansson
On 1/5/2015 7:24 AM, Chris Angelico wrote: On Mon, Jan 5, 2015 at 8:34 PM, Jonas Wielicki wrote: As a first iteration, I would try with any editor written in Python. Are you familiar with the ast[1] module? It could be worth trying to use this module and perform some kind of pattern matching o

toStringList in PyQt5

2015-01-05 Thread Suhail Mahmood
I was following the examples in 'Rapid GUI Development with Python and Qt' by Mark Summerfield. Sadly I am using PyQt5 and all the examples in this book are for PyQt4. But I have converted the codes to PyQt5 codes. But still I am having some problems. In chapter 6, there is something called QStr

Re: need some guidance on Python syntax smart editor for use with speech recognition

2015-01-05 Thread Eric S. Johansson
On 1/5/2015 3:12 AM, Chris Angelico wrote: On Mon, Jan 5, 2015 at 6:43 PM, Eric S. Johansson wrote: The obvious answer is saving that meta-information in conjunction with the code but when working in a team environment, that information is going to drive you handies up the wall because it's go

Re: problem with for and if

2015-01-05 Thread Shiyao Ma
On Jan 05 at 22:38 +0800, Shiyao Ma wrote: > More preferably, you should repetitively use "str.find" > > Or just use `max(0,len(zmienna.split(szukana))-1)` Forgot there was a `str.count`, ;). -- Shiyao Ma http://introo.me -- https://mail.python.org/mailman/listinfo/python-list

Re: problem with for and if

2015-01-05 Thread MRAB
On 2015-01-05 14:27, Dariusz Mysior wrote: I want search count of szukana in zmienna but code below counting all 12 letters from "traktorzysta" word szukana="t" zmienna="traktorzysta" def gen(): count=int(0) for a in zmienna: if szukana in zmienna: count+=1

Re: problem with for and if

2015-01-05 Thread Dariusz Mysior
W dniu poniedziałek, 5 stycznia 2015 15:28:07 UTC+1 użytkownik Dariusz Mysior napisał: > I want search count of szukana in zmienna but code below counting all 12 > letters from "traktorzysta" word > > szukana="t" > zmienna="traktorzysta" > > > def gen(): > count=int(0) > for a in zmien

Re: problem with for and if

2015-01-05 Thread Chris Warrick
On Mon, Jan 5, 2015 at 3:27 PM, Dariusz Mysior wrote: > I want search count of szukana in zmienna but code below counting all 12 > letters from "traktorzysta" word First off, I recommend that you do not write code in Polish — use English so that everyone can understand your code. Your error is

Re: problem with for and if

2015-01-05 Thread YBM
Le 05/01/2015 15:27, Dariusz Mysior a écrit : I want search count of szukana in zmienna but code below counting all 12 letters from "traktorzysta" word szukana="t" zmienna="traktorzysta" def gen(): count=int(0) for a in zmienna: if szukana in zmienna: count+=1

Re: problem with for and if

2015-01-05 Thread Shiyao Ma
On Jan 05 at 06:27 -0800, Dariusz Mysior wrote: > I want search count of szukana in zmienna but code below counting all 12 > letters from "traktorzysta" word > > szukana="t" > zmienna="traktorzysta" > > > def gen(): > count=int(0) > for a in zmienna: > if szukana in zmienna: >

problem with for and if

2015-01-05 Thread Dariusz Mysior
I want search count of szukana in zmienna but code below counting all 12 letters from "traktorzysta" word szukana="t" zmienna="traktorzysta" def gen(): count=int(0) for a in zmienna: if szukana in zmienna: count+=1 else: continue return count

Re: apostrophe not considered with tkinter's wordstart and wordend

2015-01-05 Thread Rick Johnson
On Monday, January 5, 2015 2:01:22 AM UTC-6, ravas wrote: > I'm curious about what events you would use. The only work > around I thought of is to create a word list and then > apply tags & use tag_bind(). Well i'm not sure what you are doing exactly, so i'll have to take some liberties here, but

Re: need some guidance on Python syntax smart editor for use with speech recognition

2015-01-05 Thread Chris Angelico
On Mon, Jan 5, 2015 at 8:34 PM, Jonas Wielicki wrote: > As a first iteration, I would try with any editor written in Python. > Are you familiar with the ast[1] module? It could be worth trying to > use this module and perform some kind of pattern matching on the > results to recover the informatio

Re: how to select all the monday form "20150101" till "20150620"?

2015-01-05 Thread Chris Angelico
;%Y%m%d")) > > > I have selected all the monday form "20150101" till "20150620",how to make > it more simple? I'm not sure, but I suspect your freq="D" parameter means that it gives you sequential days. If you start at 20150105 (which is a Monday),

Re: need some guidance on Python syntax smart editor for use with speech recognition

2015-01-05 Thread Jonas Wielicki
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Dear Eric, On 05.01.2015 08:43, Eric S. Johansson wrote: > what's a good open editor ( preferably multiplatform) that > actually decomposes Python code into fundamental components such as > class, expression, etc. and, lets you operate on those comp

which specified python module can monitor text information in Windows GUI

2015-01-05 Thread Chambers yin
Which kind of specified python module can monitor text in Windows GUI or support the similar function? Br, -Chambers -- https://mail.python.org/mailman/listinfo/python-list

Re: list comparison vs integer comparison, which is more efficient?

2015-01-05 Thread Jonas Wielicki
On 04.01.2015 13:17, austin aigbe wrote > Hi Terry, > > No difference between the int and list comparison in terms of the number of > calls(24) and time (0.004s). Main part is the repeated call to sqrt(). > > However, it took a shorter time (0.004s) with 24 function calls than your > code (0.00

how to select all the monday form "20150101" till "20150620"?

2015-01-05 Thread length power
import pandas as pd rng = pd.date_range("20150101","20150620",freq="D") for day in rng: x = pd.to_datetime(day) y = x.timetuple().tm_wday if(y == 0) :print(x.strftime("%Y%m%d")) I have selected all the monday form "20150101" till "20150620",how to make it more simple? -- https://mail.p

Re: Command Line Inputs from Windows

2015-01-05 Thread James Scholes
Chris Angelico wrote: > The latter form is governed by the association. I don't know off-hand > where that's set in the registry, but you should be able to poke > around in folder settings to find it (but, thank you very much > Microsoft, the exact menu path has changed a number of times between >

Re: surprise - byte in set

2015-01-05 Thread Amir Arsalan
Hi my friends. On last result you have a , b , c binary. >> set('abc') {'a','b','c') >> set(b'abc') {97,98,99} On Jan 3, 2015 10:25 PM, "patrick vrijlandt" wrote: > Hello list, > > Let me first wish you all the best in 2015! > > Today I was trying to test for occurrence of a byte in a set ...

If you were starting a project with XML datasource using python

2015-01-05 Thread flebber
Hi I need some advice on managing data in the form of xml. I will have to repeatedly import a small xml file but with many complex attributes. If I want to retain data integrity and keep the import process simple and querying from the stored source simple what are my best options? There are se

Re: Help with map python 2

2015-01-05 Thread flebber
> In py2, map produces a list already. In any case, above is syntax error > without else clause. > > map(lambda x: x * -1 if x%2 else x, series) > > If you do not have a function already, a list comp is better. > > [(-1*k if k%2 else k) for k in range(2, N)] > > Change [] to () and you have

Re: Help with map python 2

2015-01-05 Thread flebber
> You could do what mathematicians do when they deal with alternating > signs: they raise -1 to the power of the index to get an appropriate > multiplier. > >>>> [ n * (-1) ** n for n in range(10) ] >[0, -1, 2, -3, 4, -5, 6, -7, 8, -9] >>>> > > Or you could do here what you attempt

Direct3D/DirectX interception ?

2015-01-05 Thread Skybuck Flying
Hello, On the topic of Direct3D/DirectX interception ? Is this possible with Python ? If so how to do it ? Can you give example and/or links ? Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: need some guidance on Python syntax smart editor for use with speech recognition

2015-01-05 Thread Chris Angelico
On Mon, Jan 5, 2015 at 6:43 PM, Eric S. Johansson wrote: > The obvious answer is saving that meta-information in conjunction with the > code but when working in a team environment, that information is going to > drive you handies up the wall because it's going to visually overwhelm the > actual co

Re: apostrophe not considered with tkinter's wordstart and wordend

2015-01-05 Thread ravas
Thanks guys :-] Rick Johnson: > but you could implement any pattern matching you want > by binding the correct events and then processing the > "target string" on the Python side. I'm curious about what events you would use. The only work around I thought of is to create a word list and then app