>Dennis Lee Bieber:
> Timer() is a one-shot; per the OPs requirements even it would need
> to be placed within a loop to invoke multiple calls -- so there isn't
> much gain in terms of lines of code... And worse, since it calls the
> function asynchronously and not sequentially, a delay time
from threading import Timer
def Func_to_call:
do_stuff()
my_timer = Timer(10, Func_to_call)
my_timer.start()
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 5, 3:42 pm, Maxim Khitrov wrote:
> I'm not talking about the Timer, I'm talking about the original
> question. There's nothing (that I know of) you can do with a Timer on
> Windows to interrupt a raw_input call.
That is true. But if the issue here is to present a question, and
await answe
On Dec 5, 3:07 pm, Maxim Khitrov wrote:
>
> Doesn't work on Windows.
>
> - Max
Yes, it does. I've used it a lot, also in Py2Exe apps. Try the
documentation example yourself
def hello():
print "hello, world"
t = Timer(30.0, hello)
t.start() # after 30 seconds, "hello, world" will be printed
The easiest wasy is to use the Timer object in the threading module.
from threading import Timer
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Finite automata works for "nested things".
http://en.wikipedia.org/wiki/Automata_theory
--
Lars Rune Nøstdal
http://nostdal.org/
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 12, 12:03 am, Michel Bouwmans <[EMAIL PROTECTED]> wrote:
>
> Qt Designer. And creating the GUI yourself in the text editor isn't that
> bad, plus you have much better control over it.
If you like designing isual elements in an editor, that's fine for
me!
I don't,
And as I don't do it all th
On Apr 11, 8:35 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> wxDesigner.
Yeah, but it's like Heron of Alexandria's Aeolipile compared to the
steam engine of James Watt.
IMHO, GUI with Python is pain, pain and utter pain. Even boring and
meaningless pain.
--
http://mail.python.org/mailman/listin
On Apr 10, 3:54 am, Chris Stewart <[EMAIL PROTECTED]> wrote:
...
>
> Next, what would you say is the best framework I should look into?
> I'm curious to hear opinions on that.
GUI-programming in Python is a neanderthal experience. What one may
love with console scripts is turned upside-down. Proj
On Mar 13, 9:14 pm, "Mauro \"Baba\" Mascia" <[EMAIL PROTECTED]> wrote:
> Hi, this is my question:
>
> I want to know if several switch (about 50) in a big lan are up and then
> know their MAC addresses to do a list that contains host name, ip and mac.
> I know only the range of their IP addresses (
Yes, you have name.has_key(name_key) and perhaps better, the in
operator:
if name_key in name:
do something
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 8, 5:12 pm, [EMAIL PROTECTED] wrote:
> I am using a script with a single file containing all data in multiple
> sections. Each section begins with "#VS:CMD:command:START" and ends
> with "#VS:CMD:command:STOP". There is a blank line in between each
> section. I'm looking for the best way to
On Feb 25, 3:01 am, [EMAIL PROTECTED] wrote:
> In my case, I have a list of 9 tuples. Each tuple has 30 items. The first
> two items are 3-character strings, the remaining 28 itmes are floats.
>
> I want to create a new list from each tuple. But, I want the selection of
> tuples, and their assi
You could try "some_string".encode('rot_13')
--
http://mail.python.org/mailman/listinfo/python-list
Or, slighly slower, but more general:
def swap(s, order=(3,4,2,0,1)):
# assert len(s) >= len(order)
return ''.join([s[o] for o in order]) + s[6:]
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 14, 1:08 pm, "amadain" <[EMAIL PROTECTED]> wrote:
> I was wondering if there was a nicer way to swap the first 2
> characters in a string with the 4th and 5th characters other than:
>
> darr=list("010203040506")
> aarr=darr[:2]
> barr=darr[4:6]
> darr[:2]=barr
> darr[4:6]=aarr
> result="".jo
On Sat, 23 Dec 2006 12:38:30 -0800, Fuzzyman wrote:
>
> Lars Rune Nøstdal wrote:
>> On Fri, 08 Dec 2006 03:07:09 -0800, Mark Tarver wrote:
>>
>> > How do you compare Python to Lisp? What specific advantages do you
>> > think that one has over the other?
&g
education.
>
> Mark
Kill this frakkin thread; Lisp rules -- while Python is boring (but better
than many other alternatives). E.O.F.
--
Lars Rune Nøstdal
http://nostdal.org/
--
http://mail.python.org/mailman/listinfo/python-list
f you are
> willing to write your own libraries.
*lol* Good luck with that attitude:
http://redwing.hutman.net/~mreed/warriorshtm/troglodyte.htm
..or did you forget to add "in theory"; which is of course what everyone
already knows as they see their compilers do it every day.
--
On Thu, 02 Nov 2006 06:08:00 +0100, Lars Rune Nøstdal wrote:
> On Wed, 01 Nov 2006 20:48:12 -0800, Geoffrey Summerhayes wrote:
>
>> Picture this: Hey, I'm switching to COBOL because its new
>> logo looks great on t-shirts and mugs.
>
> Maybe the extra funding
often on it.
I'm not totally serious; but maybe some way of donating money to further
improvement of SBCL/Slime/something-cool-and-universally-needed-here would
be OK or something.
..I need a new t-shirt anyways; the Ubuntu t-shirt has gone missing.. :(
--
Lars Rune Nøstdal
http://l
Sriram Krishnan wrote:
> I'm running Python 2.4.3 on Windows Vista June CTP. I'm not able to
> open any site using the urllib2 and related family of modules
My wil guess is that it is a firewall problem. Perhaps you'll have to
specify that python.exe is trusted.
--
http://mail.python.org/mailm
[EMAIL PROTECTED] wrote:
> Is there a Python module that, given a URL, will grab a screenshot of
> the web page it goes to? I'd like to be able to feed such a module a
> list of URLs from a file.
>
> Thanks very much.
Not as I know of, but it's easy to write
Something like this quasi-code:
impor
> so fastest overall
you may experience speed-ups by using
from itertools import izip
and just use izip() instead to avoid the module namespace lookup. The
same applies for the list.append() methods. If you're appending some
million times
a_list = []
a_list_append = a_list.append
a_list_append
itertools.izip is usually faster than zip. You can try that.
--
http://mail.python.org/mailman/listinfo/python-list
bruce wrote:
> hi...
>
> i'm running into a problem where i'm seeing non-ascii chars in the parsing
> i'm doing. in looking through various docs, i can't find functions to
> remove/restrict strings to valid ascii chars.
>
> i'm assuming python has something like
>
> valid_str = strip(invalid_str)
>
Grant Edwards wrote:
> I just use signal.alarm():
>
> import signal,sys
>
> def alarmHandler(signum, frame):
> raise 'Timeout'
>
> signal.signal(signal.SIGALRM, alarmHandler)
>
> while 1:
> try:
> signal.alarm(5)
> t = sys.stdin.readline()
> signal.alarm(0)
>
[EMAIL PROTECTED] wrote:
> Rune Strand wrote:
> > >
> > > I am doing alot of reading, and the problem didnt come with an answer.
> > > I dont understand how to get it to continually input numbers and add
> > > all those together
> >
> > Use wh
>
> I am doing alot of reading, and the problem didnt come with an answer.
> I dont understand how to get it to continually input numbers and add
> all those together
Use while, raw_input, sys.argv[1] and int() and break the loop when the
sum is above 100.
;-)
--
http://mail.python.org/mailman/
Devon G. Parks wrote:
> I've been searching google and this group for a while now for a good
> tutorial on making a Tetris-style game in Python. I hear Tetris is a
> good starting point, and although I am fairly new to programming I
> think I would learn best if I had some code to experiment with
In 2002, I was in need of a multi-platform language. My choice became
Python, in spite of friends fiercly defending Perl and some interesting
Slashdot-articles on Ruby. But back on university, I met a very, very
pretty C++ girl who said many favourable things about Python. She never
became mine, bu
Rosario Morgan wrote:
> Hello
>
> Help is great appreciated in advance.
>
> I need to loop through a file 6000 bytes at a time. I was going to
> use the following but do not know how to advance through the file 6000
> bytes at a time.
>
> file = open('hotels.xml')
> block = file.read(6000)
> newb
[EMAIL PROTECTED] wrote:
> hi
>
> if i have a some lines like this
> a ) "here is first string"
> b ) "here is string2"
> c ) "here is string3"
>
> When i specify i only want to print the lines that contains "string" ie
> the first line and not the others. If i use re module, how to compile
> the
Is it possible by use of pyWin32 or ctypes to make a screen capture of
an inactive, or a hidden window if the hwnd/WindowName/ClassName is
known? I've seen dedicated screen capture software do this. While
PIL.ImageGrab.grab() is excellent, it will only capture the foreground
of the desktop. I've t
Jeremy Sanders wrote:
> Hi - Is it possible to override the import process so that if in my program
> I do
(...)
>
> Any ideas?
Why not handle the foo.bar/version string separately and just append
the resulting path to sys.path?
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee wrote:
> I'm sorry to trouble everyone. But as you might know, due to my
> controversial writings and style, recently John Bokma lobbied people to
> complaint to my web hosting provider. After exchanging a few emails, my
> web hosting provider sent me a 30-day account cancellation notice l
Welfare is not a built-in, but in some distributions it's available as
a module. Just type import Welfare. However, be aware of the
Welfare.division() queerness. It won't be fixed until the Python 3000
is a fact. There is also some issues with the garbage collection. Under
certain circumstances the
gene tani wrote:
> Rune Strand wrote:
> > Is there a way to measure how much memory a data structure use? For
> > instance, what is the footprint of a particular list object like
> > [0,1,2,3,4,5,6,7,8,9]?
>
> i have a note to try this, but haven't got around t
Is there a way to measure how much memory a data structure use? For
instance, what is the footprint of a particular list object like
[0,1,2,3,4,5,6,7,8,9]?
--
http://mail.python.org/mailman/listinfo/python-list
HNT20 wrote:
> Hello All
>
def ascii_to_bin(char):
ascii = ord(char)
bin = []
while (ascii > 0):
if (ascii & 1) == 1:
bin.append("1")
else:
bin.append("0")
ascii = ascii >> 1
bin.reverse()
binary = "".join(bin)
zerofix = (8
gregarican wrote:
> 1) Smalltalk - The original object oriented programming language.
> Influenced anything from Mac/Windows GUI to Java language.
No. Simula is the "original object oriented programming language".
--
http://mail.python.org/mailman/listinfo/python-list
I've set up that combo several times. I haven't had any problems. I
just looked at apach.conf, it's the same line. Did you run the
mod_python-3.2.8.win32-py2.4.exe installer?
--
http://mail.python.org/mailman/listinfo/python-list
Haibao Tang wrote:
> with high accuracy...
>
> My temporary plan is to first recognized consecutive two or three
> initial-capitalized words, but certainly we need to do more than that?
> Anyone has suggestions?
>
> Thanks first.
It's not easy to say without seeing the HTML. If you the structure
I bet the ∑-book also has some λ-stuff in it. If it doesn't, it
probably uses some other greek letters that aren't mentioned on the
cover. It's such a shame, really ... :(
--
Lars Rune Nøstdal
http://lars.nostdal.org/
--
http://mail.python.org/mailman/listinfo/python-list
Frank Millman wrote:
> Hi all
>
> Assume a 2-dimensional list called 'table' - conceptually think of it
> as rows and columns.
>
> Assume I want to create a temporary copy of a row called 'row',
> allowing me to modify the contents of 'row' without modifying the
> contents of 'table'.
>
> I used t
JuHui wrote:
> >>> a='String'
> >>> for x in a:
> ... print x
> ...
> S
> t
> r
> i
> n
> g
> >>>
>
> can I get the index number of a in the upon loop within for x in a
> loop?
for x, y in enumerate(a)
print x, y
--
http://mail.python.org/mailman/listinfo/python-list
kbperry wrote:
> In Python,
> When using the default except (like following)
>
> try:
> some code that might blow up
>
> except:
> print "some error message"
>
>
> Is there a way to show what error it is throwing?
>
> Like in Java, you can do
> catch (Exception e){
> System.out.println
kbperry wrote:
> Questions:
> Does Acrobat Pro, have some way to interface with it command-line (I
> tried searching, but couldn't find anything)? Is there any other good
> way to script word to pdf conversion?
>
> Note: The word documents do contain images, and lots of stuff besides
> just text
Aahz wrote:
> If you were going to name three or five essential recipes from the
> Python Cookbook suitable for beginners, what would you pick?
>
> Yes, this is for _Python for Dummies_, so idioms that aren't in the
> Cookbook are also fine.
If it's for _beginners_ / _dummies_, I would expect thi
[EMAIL PROTECTED] wrote:
> Please let me state off the cuff that I'm not after a big "Python Vs
> Ruby" war or anything here! I'm trying to make the switch to Python for
> my web development work as I've been using it for quite some time for
> other programming work (albeit mainly hobby and person
I think you want the Queue module in standard lib. Haven't started a
thread yet without it :)
regards
/rune
--
http://mail.python.org/mailman/listinfo/python-list
hi,
everyone thinks youreoay faggot and that youreh stupid .. now go
fugkght yourselfes
peasse out .. yo!
--
http://mail.python.org/mailman/listinfo/python-list
I've read a lot of your comments the last years. Your friendliness
always strikes me.
--
http://mail.python.org/mailman/listinfo/python-list
Ok, Alex. I know a good explanation when I see one. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
> those modules are already imported when Python gets to your code, so
> the only "overhead" you're saving is a little typing.
I don't understand this. Could you please elaborate? - if sys or os
are not imported for any other causes how are they already imported?
Maybe I'm wrong here, and accessi
Excuse me, do you suffer from a bad hair-day? I didn't say it is
platform independant. It's ok for my use on Linux and Windows. If you
cannot imagine any other usecase for a __filename__ attribute, that's
your problem, not mine.
--
http://mail.python.org/mailman/listinfo/python-list
I Steve,
I know it's several ways to isolate the filename. I just want to avoid
the overhead of importing sys or os to achieve it.
Currently I have this in my scripts:
__filename__ = __file__.replace('\\', '/').rsplit('/', 1)[-1]
--
http://mail.python.org/mailman/listinfo/python-list
Is it an idea to include a new __filename__ predefined attribute to
2.5, so that __file__ contains the entire path to the module, and
__filename__ only the name of the module?
For instance it's useful to include a not-static reference to the
filename in a scripts usage() section and it's cumbersom
It's not about GUI, but it's a good book. It's both online and printed:
http://diveIntoPython.org
--
http://mail.python.org/mailman/listinfo/python-list
year = '2005'
week = 50
weekday = 1 # Monday is 1
time_expr = '%s, %s, %s' % (year, week, weekday)
time_struct = time.strptime(time_expr, "%Y, %W, %w")
print time.strftime("%Y%m%d", time_struct)
But the datetime module may have an easier way
--
http://mail.python.org/mailman/listinfo/python-li
Mike Tammerman wrote:
> I am trying to execute an executable or a pyton script inside my
> program. I looked at the subprocess and os module. But all the
> functions in these modules blocks my application. What I want to do is
> run the subprocess without any concern. I don't care of its return ty
It's not clear to me from your posting what possible order the tags may
be inn. Assuming you will always END a section before beginning an new,
eg.
it's always:
A
some A-section lines.
END A
B
some B-section lines.
END B
etc.
And never:
A
some A-section lines.
B
some B-section lines.
END B
You have the environment variable APPDATA. You can access it with
os.environ().
--
http://mail.python.org/mailman/listinfo/python-list
BORT wrote:
> Please forgive me if this is TOO newbie-ish.
>
> I am toying with the idea of teaching my ten year old a little about
> programming. I started my search with something like "best FREE
> programming language for kids." After MUCH clicking and high-level
> scanning, I am looking at
Annoyed by windows? Check this URL:
http://www.annoyances.org/exec/show/category01
;-)
--
http://mail.python.org/mailman/listinfo/python-list
Brett Hoerner wrote:
> Another problem with cmd.com is when I run IPython, if I have an error,
> or tab or anything, I get the speaker beep (ala linux) but I can't find
> a way to turn it off. This is a huge problem because I cannot disable
> my system speaker on my laptop (not even in BIOS like
:-/ You're right!
--
http://mail.python.org/mailman/listinfo/python-list
But iif it are many lists in the file and they're organised like this:
['a','b','c','d','e']
['a','b','c','d','e']
['A','B','C','D','E'] ['X','F','R','E','Q']
I think this'll do it
data = open('the_file', 'r').read().split(']')
lists = []
for el in data:
el = el.replace('[', '').strip()
nd of thing.
import os
from subprocess import Popen
outfile = open("out.txt","w")
errfile = open("err.txt","w")
pid = Popen([os.environ["JAVA_HOME"]+/bin/java,
"-classpath",
".",
"MyJavaExecutable&qu
On XP at least you have the environment variable "ProgramFiles".
You can fetch the path it holds through os.environ
--
http://mail.python.org/mailman/listinfo/python-list
John,
I wrote a script that autmates the conversion from XLS to CSV. It's
easy. But your points are still good. Thanks for making me aware the
xlrd module!
--
http://mail.python.org/mailman/listinfo/python-list
The key is Python for Windows :
http://starship.python.net/crew/mhammond/win32/
See here for an Excel dispatch example:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/325735
When doing such operations, I generally save all the Excel files to CSV
files and do the operations on them using
[Tim Peters]
> What is "XWwz"? Assuming it's a bizarre typo for "open", change the
> 'w' there to 'wb'. Pickles are binary data, and files holding pickles
> must be opened in binary mode, especially since:
>
> > ...
> > (on WinXP, CPython 2.4.1)
Thanks Tim. The bizarre 'typo' appears to be cause
I'm experiencing strange errors both with pickle and cPickle in the
below code:
import cPickle as pickle
#import pickle
from string import ascii_uppercase
from string import ascii_lowercase
def createData():
d1 = list("Something's rotten")
d2 = tuple('in the state of Denmark')
d3 =
What would it take to create a Firefox extension that enables Python as
a script language in the browser - just like Javascript? Is it at all
possible? Are the hundred good reasons not to bother?
I once made an application that used MozPython[1]. It was fun and very
fast compared to the Mod_Python
Without seeing any code, it's hard to tell, but it's not a wild guess
that 'six inside for loops' may be replaced by more efficient ways ;-)
--
http://mail.python.org/mailman/listinfo/python-list
You're right. I somehow missed the index part :-o. It's easy to fix
though.
--
http://mail.python.org/mailman/listinfo/python-list
"Richard Brodie" <[EMAIL PROTECTED]> writes:
> "Rune Froysa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>
>> From http://www.xmlrpc.com/spec ::
>> Any characters are allowed in a string except < and &, which are
>&
acter ::
Consequently, XML processors MUST accept any character in the range
specified for Char
...
Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10]
(I'm aware that xmlrpclib.Binary can be used as an ugly work-around.)
--
Rune Frøysa
--
http://mail.python.org/mailman/listinfo/python-list
y data from the blob field to the gzipped
string it was stored as (java stores the string, Pickle is not an option)?
regards
/rune
--
http://mail.python.org/mailman/listinfo/python-list
80 matches
Mail list logo