On Friday, 8 August 2014 23:03:18 UTC+1, Ian wrote:
> On Fri, Aug 8, 2014 at 3:01 AM, Paul Wolf wrote:
>
> > * Uses SystemRandom class (if available, or falls back to Random)
> A simple improvement would be to also allow the user to pass in a
> Random object
That is not a bad idea. I'll create
On Saturday, August 9, 2014 8:36:28 AM UTC+5:30, Steven D'Aprano wrote:
> luofeiyu wrote:
> > >>> x=["x1","x3","x7","x5","x3"]
> > >>> x.index("x3")
> > 1
> > if i want the result of 1 and 4 ?
> def index_all(source, target):
> results = []
> for i, obj in enumerate(source):
> i
luofeiyu wrote:
> >>> x=["x1","x3","x7","x5","x3"]
> >>> x.index("x3")
> 1
> if i want the result of 1 and 4 ?
def index_all(source, target):
results = []
for i, obj in enumerate(source):
if obj == target:
results.append(i)
return results
index_all(x, "x3")
=> r
On Sat, Aug 9, 2014 at 12:51 PM, John Gordon wrote:
> You probably meant something like this instead:
>
> sql = "DELETE FROM tblc_users WHERE user_email=%s" % line
>
> This will substitute the value of line for the %s.
>
> However, most (all?) SQL databases require string values to be enclosed
When i input usb line with my android phone into the pc , there are two
disks j: and k: (type :removable disk) displayed in win7.
i can get my android phone bluetooth mac address .
import bluetooth
nearby_devices = bluetooth.discover_devices(lookup_names = True)
for addr, phoneName in nearby_d
In Matt Smith
writes:
> I am trying to write a program that will loop through a text file and
> delete rows in a mysql database.
> It seemingly runs but I don't see anything getting deleted in the db.
> Is there anything apparent that I am missing?
> This is the code:
> #!/usr/bin/python
> im
On Sun, Aug 10, 2014 at 3:33 AM, luofeiyu wrote:
> print("hallo") is so simple.
>
> how can print word "hallo" in console with courier New font 16 pound?
You'd have to look to your console's settings; generally, you can't
change fonts. For that kind of work, what you want is an actual GUI;
the
On Sun, Aug 10, 2014 at 3:35 AM, luofeiyu wrote:
x=["x1","x3","x7","x5","x3"]
x.index("x3")
> 1
> if i want the result of 1 and 4 ?
Want to know what you can do with some object? Try this:
>>> help(x)
In this case, though, I suspect there's no built-in to search for
*all* of the occur
>>> x=["x1","x3","x7","x5","x3"]
>>> x.index("x3")
1
if i want the result of 1 and 4 ?
On 8/8/2014 7:25 PM, Larry Martell wrote:
On Sat, Aug 9, 2014 at 1:22 PM, luofeiyu wrote:
x=["x1","x3","x7","x5"]
y="x3"
how can i get the ordinal number by some codes?
for id ,value in enumerate(x):
print("hallo") is so simple.
how can print word "hallo" in console with courier New font 16 pound?
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Aug 8, 2014 at 4:38 PM, Chris Angelico wrote:
> On Sat, Aug 9, 2014 at 8:01 AM, Chris Kaynor
> wrote:
> > However, I'd recommend re-raising the exception after rolling back the
> > transaction with a bare "raise" statement right after the db.rollback()
> - at
> > the absolute minimum, yo
On Sat, Aug 9, 2014 at 1:22 PM, luofeiyu wrote:
x=["x1","x3","x7","x5"]
y="x3"
>
> how can i get the ordinal number by some codes?
>
> for id ,value in enumerate(x):
> if y==value : print(id)
>
> Is more simple way to do that?
print x.index(y)
--
https://mail.python.org/mailman/li
>>> x=["x1","x3","x7","x5"]
>>> y="x3"
how can i get the ordinal number by some codes?
for id ,value in enumerate(x):
if y==value : print(id)
Is more simple way to do that?
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Aug 8, 2014 at 5:13 PM, Chris Angelico wrote:
> On Sat, Aug 9, 2014 at 9:55 AM, Chris Kaynor
> wrote:
> > try:
> > action
> > commit
> > finally:
> > rollback
>
> If commit/rollback automatically opens a new transaction, this would
> just roll back an empty transaction - not
Ok so I am working on a little project and I cant seem to solve something with
it. I have a label and then a clear button and I want all the numbers in the
label to clear when I push the button. This button is on a separate frame to
the buttons. I would like to clear the frame and then set all t
On Sat, Aug 9, 2014 at 10:32 AM, Chris Kaynor wrote:
> The main issue I can see with that idea is that the exception will keep a
> reference to the database connection (as with all locals), so unless you
> explicitly close it within a finally clause, the database connection could
> still be left h
On Sat, Aug 9, 2014 at 9:55 AM, Chris Kaynor wrote:
> try:
> action
> commit
> finally:
> rollback
If commit/rollback automatically opens a new transaction, this would
just roll back an empty transaction - not a big deal. But yes, I do
see what you're looking at here.
However, struct
On Sat, Aug 9, 2014 at 8:01 AM, Chris Kaynor wrote:
> However, I'd recommend re-raising the exception after rolling back the
> transaction with a bare "raise" statement right after the db.rollback() - at
> the absolute minimum, you should log the error. This will likely let you see
> what your pro
Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64
bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> str='(\\HasNoChildren \\Junk) "/" "[Gmail]/&V4NXPpCuTvY-"'
>>> str.split(" ")
['(\\HasNoChildren', '\\Junk)', '"/"', '"[Gmail]
On Fri, Aug 8, 2014 at 12:07 PM, Matt Smith wrote:
> I am trying to write a program that will loop through a text file and
> delete rows in a mysql database.
>
> It seemingly runs but I don't see anything getting deleted in the db.
> Is there anything apparent that I am missing?
>
> This is the
On Sat, Aug 9, 2014 at 4:35 AM, Neil D. Cerutti wrote:
> Doesn't any natural looking use of blocking=False suffer from the same race
> condition? What's the correct way to use it?
Actually, I don't know. I try to avoid any form of thread locking
where possible, and I don't remember the last time
On Sat, Aug 9, 2014 at 5:07 AM, Matt Smith wrote:
> # Prepare SQL query to DELETE required records
> sql = "DELETE FROM tblc_users WHERE user_email=%s, % (line)"
> try:
> # Execute the SQL command
> cursor.execute(sql)
> # Commit your changes i
On Sat, Aug 9, 2014 at 4:04 AM, Steven D'Aprano
wrote:
> Chris Angelico wrote:
>
>> On Fri, Aug 8, 2014 at 11:58 PM, Steven D'Aprano
>> wrote:
>>> Chris Angelico wrote:
>>>
Yeah; like I said, "Don't" is the short answer. There will be
exceptions, some extremely rare situations when syst
On 08/08/2014 01:45 PM, cwolf.a...@gmail.com wrote:
> On Friday, August 8, 2014 10:35:12 AM UTC-4, Skip Montanaro wrote:
>> P.S. Probably a topic for a separate thread, and not actually
>> Python-related, but on a related note, I have never found a free password
>> keeper which works on all my p
On Fri, Aug 8, 2014 at 3:01 AM, Paul Wolf wrote:
> * Uses SystemRandom class (if available, or falls back to Random)
A simple improvement would be to also allow the user to pass in a
Random object, in case they have their own source of randomness they
want to use, or for fake Randoms used for wri
On 08/08/2014 20:07, Matt Smith wrote:
I am trying to write a program that will loop through a text file and
delete rows in a mysql database.
It seemingly runs but I don't see anything getting deleted in the db.
Is there anything apparent that I am missing?
This is the code:
#!/usr/bin/python
i
On Fri, Aug 8, 2014 at 3:07 PM, Matt Smith wrote:
> I am trying to write a program that will loop through a text file and delete
> rows in a mysql database.
>
> It seemingly runs but I don't see anything getting deleted in the db.
> Is there anything apparent that I am missing?
>
> This is the cod
I am trying to write a program that will loop through a text file and
delete rows in a mysql database.
It seemingly runs but I don't see anything getting deleted in the db.
Is there anything apparent that I am missing?
This is the code:
#!/usr/bin/python
import mysql.connector
#
f=open('/home/smi
On Fri, Aug 8, 2014 at 7:25 AM, Ethan Furman wrote:
> On 08/08/2014 04:51 AM, cool-RR wrote:
>>
>>
>> If I want to acquire a `threading.Lock` using the context manager
>> protocol,
>> is it possible to specify the `blocking` and `timeout` arguments that
>> `acquire` would usually take?
>
>
> Not
On Fri, Aug 8, 2014 at 11:35 AM, Neil D. Cerutti wrote:
> On 8/8/2014 12:16 PM, Chris Angelico wrote:
>
>> On Sat, Aug 9, 2014 at 2:05 AM, Neil D. Cerutti
>> wrote:
>>
>>> Perhaps defer release, a la a common Go pattern:
>>>
>>> with contextlib.ExitStack() as stack:
>>> acquired = lock.acqu
On 8/8/2014 2:35 PM, Neil D. Cerutti wrote:
Here's another attempt at context managing:
@contextlib.contextmanager
def release_if_acquired(lock, blocking=True, timeout=-1):
acquired = lock.acquire(blocking, timeout)
if acquired:
yield acquired
lock.release()
e
On Friday, August 8, 2014 10:35:12 AM UTC-4, Skip Montanaro wrote:
> One suggestion, though perhaps nothing actually needs changing.
>
>
> I occasionally run into sites which define their password constraints as
> something like "minimum 8 characters, at least one number, one uppercase
> letter
On 8/8/2014 12:16 PM, Chris Angelico wrote:
On Sat, Aug 9, 2014 at 2:05 AM, Neil D. Cerutti wrote:
Perhaps defer release, a la a common Go pattern:
with contextlib.ExitStack() as stack:
acquired = lock.acquire(blocking=False)
if acquired:
stack.callback(lock.release)
I'm struggling with some JavaScript issues related to it's lack of
good support for modules. I know RequireJS exists (and appears to be
the most widely used add-on for this stuff), but as a novice JS
programmer, I'm having trouble wrapping my head around just what it
does. In particular, I don't se
Chris Angelico wrote:
> On Fri, Aug 8, 2014 at 11:58 PM, Steven D'Aprano
> wrote:
>> Chris Angelico wrote:
>>
>>> Yeah; like I said, "Don't" is the short answer. There will be
>>> exceptions, some extremely rare situations when system modality is
>>> correct; but fundamentally, it's impossible to
On Sat, Aug 9, 2014 at 2:05 AM, Neil D. Cerutti wrote:
> Perhaps defer release, a la a common Go pattern:
>
> with contextlib.ExitStack() as stack:
> acquired = lock.acquire(blocking=False)
> if acquired:
> stack.callback(lock.release)
> do_stuff
There's a race condition i
On 8/8/2014 9:25 AM, Ethan Furman wrote:
On 08/08/2014 04:51 AM, cool-RR wrote:
If I want to acquire a `threading.Lock` using the context manager
protocol,
is it possible to specify the `blocking` and `timeout` arguments that
`acquire` would usually take?
Not that I know of, but why would y
On Sat, Aug 9, 2014 at 12:58 AM, Rustom Mody wrote:
> Now I seem to remember this same questioner (??) asking a few months ago
> about:
>
> I have an excel program running for 20 minutes and I want to lock
> the machine or something like that
>
> And you proscribing similarly then :-)
>
> Yeah 'On
On Sat, Aug 9, 2014 at 12:45 AM, Rustom Mody wrote:
> I dont see anything about preventing access.
That came from his next post, in which he said "So that user cant do
any other operation.".
That's the preventing access bit.
Of course, if "Always On Top" is sufficient, then it's (a) easy, even
On Sat, Aug 9, 2014 at 12:50 AM, alister
wrote:
> On Fri, 08 Aug 2014 23:58:56 +1000, Steven D'Aprano wrote:
>>
>>> (for instance, on all my Linux systems, I can hit Ctrl-Alt-F1 to switch
>>> away from the GUI altogether).
>>
>> Does that work when xscreensaver or equivalent has locked the system?
On Friday, August 8, 2014 8:22:47 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Aug 9, 2014 at 12:45 AM, Rustom Mody wrote:
> > I dont see anything about preventing access.
>
>
> That came from his next post, in which he said "So that user cant do
> any other operation.".
> That's the preventing a
On Fri, 08 Aug 2014 23:58:56 +1000, Steven D'Aprano wrote:
>
>> (for instance, on all my Linux systems, I can hit Ctrl-Alt-F1 to switch
>> away from the GUI altogether).
>
> Does that work when xscreensaver or equivalent has locked the system? If
> so,
> that's a security vulnerability.
I have n
On Friday, August 8, 2014 8:04:05 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Aug 9, 2014 at 12:23 AM, Rustom Mody wrote:
> > A windows equivalent for linux's wmctrl seems to be nir
> > http://www.nirsoft.net/utils/nircmd2.html#using
> >
> > Search for 'settopmost'
>
>
> No need; both of those
One suggestion, though perhaps nothing actually needs changing.
I occasionally run into sites which define their password constraints as
something like "minimum 8 characters, at least one number, one uppercase
letter, and one special character." Their notion of "special" (which in my
mind means an
On Sat, Aug 9, 2014 at 12:23 AM, Rustom Mody wrote:
> A windows equivalent for linux's wmctrl seems to be nir
> http://www.nirsoft.net/utils/nircmd2.html#using
>
> Search for 'settopmost'
No need; both of those are just setting the "always on top" flag,
which wxpython can do directly. It may be u
On Friday, August 8, 2014 7:21:35 PM UTC+5:30, Chris Angelico wrote:
> On Fri, Aug 8, 2014 at 11:44 PM, Rustom Mody wrote:
> > On Thursday, August 7, 2014 4:54:09 PM UTC+5:30, Jaydeep Patil wrote:
> >> Hi all,
> >
> >> I have one query. I have did some programming which copies and paste data
> >>
On Fri, Aug 8, 2014 at 11:58 PM, Steven D'Aprano
wrote:
> Chris Angelico wrote:
>
>> Yeah; like I said, "Don't" is the short answer. There will be
>> exceptions, some extremely rare situations when system modality is
>> correct; but fundamentally, it's impossible to use GUI software to
>> control
Paul Wolf wrote:
> This is a proposal with a working implementation for a random string
> generation template syntax for Python. `strgen` is a module for generating
> random strings in Python using a regex-like template language. Example:
>
> >>> from strgen import StringGenerator as SG
>
Steven D'Aprano :
> Does that work when xscreensaver or equivalent has locked the system?
> If so, that's a security vulnerability.
Depends on the semantics of the screensaver. Its scope is the current
X11 session.
In my home, different family members have different VTs. Locking one VT
shouldn't
Chris Angelico wrote:
> On Fri, Aug 8, 2014 at 6:57 PM, Paul Rudin
> wrote:
>> Chris Angelico writes:
>>
>>> On Fri, Aug 8, 2014 at 3:57 PM, Jaydeep Patil
>>> wrote:
I mean to say, One GUI should be always on top from start to end of
code running. So that user cant do any other operat
On Fri, Aug 8, 2014 at 11:44 PM, Rustom Mody wrote:
> On Thursday, August 7, 2014 4:54:09 PM UTC+5:30, Jaydeep Patil wrote:
>> Hi all,
>
>> I have one query. I have did some programming which copies and paste data
>> using system clipboard. I need to keep one GUI always on top till my python
>>
On Thursday, August 7, 2014 4:54:09 PM UTC+5:30, Jaydeep Patil wrote:
> Hi all,
> I have one query. I have did some programming which copies and paste data
> using system clipboard. I need to keep one GUI always on top till my python
> code is running.
In linux you can do (at shell level)
$ wmc
On 08/08/2014 04:51 AM, cool-RR wrote:
If I want to acquire a `threading.Lock` using the context manager protocol,
is it possible to specify the `blocking` and `timeout` arguments that
`acquire` would usually take?
Not that I know of, but why would you want to? There's no built-in 'if' with
On Friday, 8 August 2014 12:29:09 UTC+1, Chris Angelico wrote:
> Debian Wheezy can spin up a Python 3 from source anyway, and
>
> presumably ditto for any other Linux distro that's distributing 3.1 or
>
> 3.2; most other platforms should have a more modern Python available
>
> one way or anothe
On Friday, 8 August 2014 12:20:36 UTC+1, Ned Batchelder wrote:
> On 8/8/14 5:42 AM, Paul Wolf wrote:
>
> Don't bother trying to support <=3.2. It will be far more difficult
>
> than it is worth in terms of adoption of the library.
>
> Also, you don't need to write a "proposal" for your libra
Hi all,
If I want to acquire a `threading.Lock` using the context manager protocol, is
it possible to specify the `blocking` and `timeout` arguments that `acquire`
would usually take?
Thanks,
Ram.
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Aug 8, 2014 at 9:20 PM, Ned Batchelder wrote:
> On 8/8/14 5:42 AM, Paul Wolf wrote:
>>
>> On Friday, 8 August 2014 10:22:33 UTC+1, Chris Angelico wrote:
>>>
>>> But I eyeballed your code, and I'm seeing a lot of
>>> u'string' prefixes, which aren't supported on 3.0-3.2 (they were
>>> rein
On 8/8/14 5:42 AM, Paul Wolf wrote:
On Friday, 8 August 2014 10:22:33 UTC+1, Chris Angelico wrote:
But I eyeballed your code, and I'm seeing a lot of
u'string' prefixes, which aren't supported on 3.0-3.2 (they were
reinstated in 3.3 as per PEP 414), so a more likely version set would
be 2.6+,
On Friday, 8 August 2014 10:22:33 UTC+1, Chris Angelico wrote:
> But I eyeballed your code, and I'm seeing a lot of
> u'string' prefixes, which aren't supported on 3.0-3.2 (they were
> reinstated in 3.3 as per PEP 414), so a more likely version set would
>
> be 2.6+, 3.3+. What's the actual versi
On Fri, Aug 8, 2014 at 6:57 PM, Paul Rudin wrote:
> Chris Angelico writes:
>
>> On Fri, Aug 8, 2014 at 3:57 PM, Jaydeep Patil
>> wrote:
>>> I mean to say, One GUI should be always on top from start to end of code
>>> running.
>>> So that user cant do any other operation.
>>> I am using wxpytho
On Fri, Aug 8, 2014 at 7:01 PM, Paul Wolf wrote:
> This is a proposal with a working implementation for a random string
> generation template syntax for Python. `strgen` is a module for generating
> random strings in Python using a regex-like template language.
Looks good! One thing, though:
>
Chris Angelico writes:
> On Fri, Aug 8, 2014 at 3:57 PM, Jaydeep Patil wrote:
>> I mean to say, One GUI should be always on top from start to end of code
>> running.
>> So that user cant do any other operation.
>> I am using wxpython
>
> Ah, that would be called "System Modal", and should be re
This is a proposal with a working implementation for a random string generation
template syntax for Python. `strgen` is a module for generating random strings
in Python using a regex-like template language. Example:
>>> from strgen import StringGenerator as SG
>>> SG("[\l\d]{8:15}&[\d]&
On 08/08/2014 01:23, elearn wrote:
str='(\\HasNoChildren \\Junk) "/" "[Gmail]/&V4NXPpCuTvY-"'
First up it's not usually a good idea to override the builtin name str.
x=str.split(' "')
[i.replace('"','') for i in x]
['(\\HasNoChildren \\Junk)', '/', '[Gmail]/&V4NXPpCuTvY-']
x.strip(" ") will
On Fri, Aug 8, 2014 at 5:17 PM, Rustom Mody wrote:
>> But with Roy's suggestion, testing for the existence of os.fork is not
>> sufficient, because it will exist even on platforms where fork doesn't
>> exist. So testing that os.fork exists is not sufficient to tell whether or
>> not you can actual
On Friday, August 8, 2014 11:18:17 AM UTC+5:30, Steven D'Aprano wrote:
> Rustom Mody wrote:
> > On Thursday, August 7, 2014 10:26:56 PM UTC+5:30, Steven D'Aprano wrote:
> >> Roy Smith wrote:
> >> > Peter Otten wrote:
> >> >> os.fork()
> >> >> Fork a child process.
> >> >> ...
> >> >> Availabilit
66 matches
Mail list logo