Hello everybody,
I'd like to split a file by double newlines, but portably. Now,
splitting by one or more newlines is relatively easy:
self.tables = re.split([\r\n]+, bulk)
But, how can I split on double newlines? I tried several approaches,
but none worked...
--
Now the storm has passed over
Dana Mon, 07 Feb 2011 19:20:38 +0100,
Peter Otten __pete...@web.de kaze:
with open(filename, U) as f:
Oh, fabulous. Thanks!
--
Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms
Dana Mon, 7 Feb 2011 10:02:05 -0800 (PST),
Ian ian.g.ke...@gmail.com kaze:
self.tables = re.split(r'(?:\r\n){2,}|\r{2,}|\n{2,}', bulk)
Thanks!
I tried without ?:, but it didn't work. Can you tell me why is it
important that group is noncapturing?
--
Now the storm has passed over me
I'm left
Is there a way to create a TCP connection using a gateway of my
choice?
I have a regular user account on a WinXP machine. It has a DNS server
and default gateway configured, and that DNS server and default
gateway don't see the rest of the Internet, just the local
network. But, I know an IP
Dana Sat, 5 Feb 2011 14:13:11 -0800,
Dan Stromberg drsali...@gmail.com kaze:
IIRC, this is an instance of what's called source routing, and was
largely shut off after network admins realized it was a security
issue.
Of course, if you have root/administrator permission, you could
probably do
Hi everybody,
I need to downcast an object, and I've read repeatedly that if you
need to downcast, you did something wrong in the design phase. So,
instead of asking how do you downcast in python, let me explain my
situation.
I have a 2-pass parser. 1st pass ends up with a bunch of superclass
Dana Mon, 25 Oct 2010 09:38:42 -0500,
Tim Chase python.l...@tim.thechases.com kaze:
While a dirty hack for which I'd tend to smack anybody who used
it...you *can* assign to instance.__class__
Wow! Python never stops to amaze me.
If it breaks you get to keep all the parts :)
Yes, I can see
Dana Sun, 17 Oct 2010 15:36:13 -0400,
Benjamin Kaplan benjamin.kap...@case.edu kaze:
On Sun, Oct 17, 2010 at 3:04 PM, Nikola Skoric n...@fly.srk.fer.hr wrote:
You're trying to write Unicode to a file. But there's no such thing as
/snip
.encode(cp1252) or whatever encoding you want to use
When I execute
n...@rilmir:~/code/simplepyged/docs/examples$ python latex.py
I get expected output (bunch of latex markup).
But, when I add a redirection, I get:
n...@rilmir:~/code/simplepyged/docs/examples$ python latex.py foo.tex
File latex.py, line 87, in module
print
I have a superclass Element and a subclass Family. All Family.__init__() does
is run Element.__init__() and self.__parse(). For some reason it seems like
self.__parse() isn't run. Here is the code:
Dana Sun, 20 Jun 2010 10:53:08 +0200,
Peter Otten __pete...@web.de kaze:
Now in your case village.py is first run as the main script and then
[...]
In the account module you indirectly raise village.ExceptionWithLongName and
in __main__ you try to catch __main__.ExceptionWithLongName.
Phew.
Dana Fri, 18 Jun 2010 20:01:45 +0200,
Peter Otten __pete...@web.de kaze:
Solution: move your startup code into a separate file and have it import the
village module.
Excellent, thanks! Everything works now, but I still don't quite get what the
problem is...
You are importing your main
Dana 18 Jun 2010 17:45:31 GMT,
Steven D'Aprano st...@remove-this-cybersource.com.au kaze:
Other than that, I notice that your module throws away useful debugging
information, and replaces it with bland, useless pap of no nutritional
value:
try:
import account, fetch, resources, const
Hi there,
I have a simple problem and I know how to solve it :-D, but I suspect that
there is a standard solution which is more elegant.
So, here is my problem: I have django app versioned with svn and I
test my trunk on two different machines (one with mysql, another with
sqlite3). How do I
I0m a python newbie with PHP background. I've tried to make a web app
from one of my python scripts (which I haven't done before) and I
ended up with:
?php
echo shell_exec(python foobar.py);
?
which works really nice :-D
For some reason I can't find no quick and dirty python web
programming
Dana Mon, 26 Nov 2007 08:50:23 -0800 (PST),
[EMAIL PROTECTED] [EMAIL PROTECTED] kaze:
Sorry I didn't reply sooner. If you're creating a service based on a
Python file, check out the following links in addition to the book
Wolfgang mentioned:
I have a very simple win32serviceutil script:
import win32serviceutil, time
win32serviceutil.StartService(burek, localhost)
time.sleep(10)
exit()
It successfuly imports win32serviceutil, and chokes on StartService:
Traceback (most recent call last):
File foobar.py, line 3, in ?
Dana Sun, 25 Nov 2007 13:52:35 -0800 (PST),
[EMAIL PROTECTED] [EMAIL PROTECTED] kaze:
Looks like Microsoft thinks you mis-spelled it.
http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/w2000Msgs/3310.mspx?mfr=true
I would check and see if that service is installed on your
Dana Thu, 15 Nov 2007 10:12:11 -0600,
Adam Pletcher [EMAIL PROTECTED] kaze:
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf
Of [EMAIL PROTECTED]
Sent: Thursday, November 15, 2007 9:56 AM
To: python-list@python.org
Subject: Re: formated local time
If
I have been trying to find appropriate way to do get local time in
-mm-dd hh:mm:ss format, but the best I got is this:
datetime.datetime.fromtimestamp(time.mktime(time.localtime()))
It seems to me I'm missing a much simpler method, am I?
--
Now the storm has passed over me
I'm left to drift
I wrote a simple UNIX daemon (using 2 forks) which does a simple job: it
executes a function, waits for some time, and then executes it again. Now
I'd like to port that to Windows. How do I create daemon on Windows (since
I can't use fork)?
--
Now the storm has passed over me
I'm left to
Is there a python library which supports using SOCKS proxy which I
create by ssh -D port remote-host? I was trying to use that socket
by SocksiPy, but I get channel 3: open failed: administratively
prohibited: open failed on the server side. And I can use that
channel freely with firefox. Any
I'm using sgmllib.SGMLParser to parse HTML. I have successfuly parsed start
tags by implementing start_something method. But, now I have to fetch the
string inside the start tag and end tag too. I have been reading through
SGMLParser documentation, but just can't figure that out... can somebody
Hello,
I have a few lines of code retrieving a web page and saving some
variables from it to a log. And everything works nice from command line.
but, when I make a cron job, I get an error:
Your cron job on fly
cd $HOME/bin/ ; python newartlog.py ; cd
produced the following output:
Traceback
Is there a way to tell the interpreter to display exceptions, even those
which were captured with except?
--
Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams
--
In article [EMAIL PROTECTED], Paul Rubin
http://[EMAIL PROTECTED] says...
Nikola Skoric [EMAIL PROTECTED] writes:
Is there a way to tell the interpreter to display exceptions, even those
which were captured with except?
Normally you wouldn't do that unless you were trying to debug
Hi there,
Is there a way of making 'utf-8' default codec for the whole program, so
I don't have to do .encode('utf-8') every time I print out a string?
--
Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across
27 matches
Mail list logo