Grant Edwards wrote:
Maybe I've got a beter news server, but I don't see much
spam at all in c.l.p.
Neither do I.
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
HMS Surprise wrote:
Have I misused .extend?
The .extend() method expects an iterable, try .append() instead.
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Alexander Seistrup
Tv-fri medielicensbetaler
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
,
urllib.urlopen(http://myip.dk/;).read())[0]'
#v-
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
]:~ $
#v-
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
socket; print
socket.gethostbyaddr(socket.gethostname())'
('zdani.szn.dk', [], ['2001:1448:89::1'])
[EMAIL PROTECTED]:~ $
#v-
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Colin J. Williams wrote:
Your one-liner doesn't work for me, with Windows XP, but the
following does, within Python.
Could it be due to shell-escaping issues? I don't know anything
about Windows...
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org
' are probably '\r\n' pairs, so you could do a
buf.replace('\r\n', '\n')
to convert all such pairs to single LFs (buf being the buffer or
string that holds the text with 'linebreaks').
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman
Rweth wrote:
for aline in buf:
bufHeal.append(aline.replace('\r\n', '\n'))
What does one single aline look like?
s.body(id,afile)
Does the 'afile' contain a filename or a filepointer?
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org
Rweth wrote:
so afile contains a filename.
One single aline looks like so:
'/rme:SoftwareIdentity'
Beats me where those empty lines come from, it doesn't seem to
happen in nntplib.
Does the same thing happen if you pass .body() a filepointer?
Cheers,
--
Klaus Alexander Seistrup
http
' ; unzip '%s' as your formatting string should work.
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Pekka Karjalainen wrote:
You can omit the call to math.sqrt if you test this instead.
y*y x
in place of if y maxfact: .
Or use
sqrt = lambda x: x ** .5
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
-except statement.
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
note that DSU is built into Python these days:
L.sort(key=transform)
Sweet, thanks for the hint.
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Rares Vernica wrote:
How does your code deal with #039; like entities?
It doesn't, it deals with named entities only. But take a look
at Fredrik's example.
Cheers,
--
Klaus Alexander Seistrup
København, Danmark, EU
http://klaus.seistrup.dk/
--
http://mail.python.org/mailman/listinfo
)]),
s
)
# end def dehtml
if __name__ == '__main__':
import sys
print dehtml(sys.stdin.read()).encode('utf-8')
# end if
#v-
E.g.:
#v+
$ echo 'fraelig;kke froslash;laring;r' | ./dehtml.py
frække frølår
$
#v-
--
Klaus Alexander Seistrup
Copenhagen, Denmark, EU
http
that contain the correct elements:
Goal = [ [ a, n, t], [ b, a, t],
[c, a, t ] ]
#v+
t = [ a, b, c, n, a, a, t, t, t ]
[t[i::3] for i in range(3)]
[['a', 'n', 't'], ['b', 'a', 't'], ['c', 'a', 't']]
#v-
Cheers,
--
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic
Tom skrev:
newDirectory = str(sys.argv[1:])
Try
newDir = '/'.join(sys.argv[1:])
or
newDir = sys.argv[1]
or
for newDir in sys.argv[1:]:
:
or something along those lines, depending on how you wish to
interpret the commandline.
Cheers,
--
Klaus Alexander
[EMAIL PROTECTED] wrote:
if histogram.has_key(s):
histogram[s] += 1
else:
histogram[s] = 1
I wonder if
histogram[s] = histogram.get(s, 0) + 1
would be more efficient...
Cheers,
--
Klaus Alexander Seistrup
Grant Edwards wrote:
Find an NNTP server and read it as a newsgroup.
Or Google Groups: http://groups.google.com/group/comp.lang.python
Cheers,
--
Klaus Alexander Seistrup
Dyssegård, Denmark
http://surdej.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Lazy Lad wrote:
Is there a blog application source available in Python?
Several. Did you try Google before you posted your question? The search
term python blog has http://wiki.python.org/moin/PythonBlogSoftware
within the first 10 hits.
Cheers,
--
Klaus Alexander Seistrup
Copenhagen
size: 173233 (371587)')
['173233', '371587']
#v-
Mvh,
--
Klaus Alexander Seistrup
Copenhagen, Denmark
http://surdej.dk/
--
http://mail.python.org/mailman/listinfo/python-list
¹). Is this a deliberate omission?
Cheers,
Klaus.
¹) http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
--
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
.
in other words, you get whatever version that was used to create
the Unicode data set in your Python distribution.
I see.
iirc, 2.4 uses Unicode 3.2, and 2.5 uses Unicode 4.1. to update,
use the tools under Tools/unicode.
Thanks for the hint.
Mvh,
--
Klaus Alexander Seistrup
-
Dictionaries are unordered and hence indices don't make much sense.
Mvh,
--
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
for passwords
#v+
import sha
sha.sha('userid,fullname,passwword,dateofbith').digest().encode('base64')[:10]
'q0nCDQ1YdL'
#v-
Mvh,
--
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Lad skrev:
How can I find out the date/time difference ( in days) of such
two fields?
Did you try to subtract one value from the other?
Mvh,
--
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Nico Grubert skrev:
you could do this:
a = datetime.datetime(2006, 5, 24, 16, 1, 26)
b = datetime.datetime(2006, 5, 20, 12, 1, 26)
a-b
datetime.timedelta(4)
# 4 days
Or
#v+
print (a-b).days
4
#v-
Mvh,
--
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic
])
a-b
set([0, 1, 2, 3, 4])
list(a-b)
[0, 1, 2, 3, 4]
#v-
Cheers,
--
Klaus Alexander Seistrup
SubZeroNet, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
. This is
recursive.
#v-
Cheers,
--
Klaus Alexander Seistrup
Copenhagen, Denmark
http://seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Falc wrote:
So if you have any books you could reccomend me that would rock, I
can't really afford a book so if online that would be excellent.
Have you looked into:
http://wiki.python.org/moin/BeginnersGuide
http://python.org/doc/Intros.html
Cheers,
--
Klaus Alexander Seistrup
Justin Ezequiel wrote:
Try
lambda_hrs = lambda x: (x/60,x%60)
Or
#v+
lambda_hrs = lambda x: divmod(x, 60)
#v-
Cheers,
--
Klaus Alexander Seistrup
PNX · http://pnx.dk/
--
http://mail.python.org/mailman/listinfo/python-list
!'
# eof
$ /tmp/hello.py
bash: /tmp/hello.py: python: bad interpreter: No such file or directory
$
#v-
Cheers,
--
Klaus Alexander Seistrup
Copenhagen, Denmark
http://streetkids.dk/
--
http://mail.python.org/mailman/listinfo/python-list
of the shebang-line, but perhaps an absolute
path is required?
PS: The Mail-Copies-To: nobody header line means that I do not wish
to receive mail replies - please follow-up to group only.
Cheers,
--
Klaus Alexander Seistrup
Copenhagen, Denmark
http://streetkids.dk/
--
http://mail.python.org
/bin/env. So the env-mechanism is increasing conven-
ience, but not strictly assuring portability.«
Cheers,
--
Klaus Alexander Seistrup
PNX · http://pnx.dk/
--
http://mail.python.org/mailman/listinfo/python-list
BroLewis wrote:
I have been trying for several weeks now to write a program that
allows me to read the stdout of a process that I spawn and once
I receive feedback, act appropriately.
Have you looked into the 'commands' module?
Cheers,
--
Klaus Alexander Seistrup
Copenhagen, Denmark
http
the rightmost) will be created if it does not exist. This
is recursive
#v-
Cheers,
--
Klaus Alexander Seistrup
Copenhagen, Denmark
http://seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
perl -e 'print Hello, world\n'
python -c 'print Hello, world'
Cheers,
--
Klaus Alexander Seistrup
Copenhagen, Denmark
http://seistrup.dk/
--
http://mail.python.org/mailman/listinfo/python-list
of controlled drugs to assist suicides, regardless of state
law.
#v-
Cheers,
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I need a Python NNTP module that is capable of doing MODE STREAM as
client and as server. Does anyone here know of such a module except
the twisted.protocols.nntp module?
Cheers,
--
Klaus Alexander Seistrup
Copenhagen, Denmark
http://streetkids.dk/
--
http://mail.python.org/mailman
ÒÊÃÉɽÈË wrote:
thanks
Did you try Google:
http://www.google.com/search?q=python+regular+expressions
First hit is:
http://www.amk.ca/python/howto/regex/
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman
Rotary wrote:
I want to say something like that: if msg is empty ...then do
something. So how can i figure that msg is empty string (no
character, msg = '').
#v+
if not msg:
print 'msg is empty'
#v-
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic
= []
for name in file_names:
files_and_lines.append([name, open(name, 'r').readlines()])
print 'Read %d files' % (len(files_and_lines),)
#v-
Add proper error checking.
At least, I think the [].append() method is what you're looking for.
Cheers,
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen
is unimportant you could use:
#v+
tuple(set(range(10)) | set(range(20,30)))
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29)
#v-
Cheers,
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python
[EMAIL PROTECTED] wrote:
I tried to fix this by changing the locale back to English
before creating cookies and that works on Windows but not for
Linux. If I use en_EN.ISO8859-1 it works on Linux but not
on Windows.
How about setting locale to C or POSIX?
--
Klaus Alexander Seistrup
Mage wrote:
I tried to write a proxy script for psql command. I need some
query log. I failed to read from the file object.
The psql command is probably linked against readline; did you look
in the ~/.psql_history file?
Cheers,
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
Michele Ferretti wrote:
ok, sorry, but subject is very explicit!
Still, it's insufficient for those of us who doesn't know what WordPress
is, and it's a waste of time for those of us who don't speak Italian.
C'mon, pal, you can do much better than that!
--
Klaus Alexander Seistrup
Magnetic
Michele Ferretti wrote:
ok, sorry, but subject is very explicit!
Still, it's insufficient for those of us who don't know what WordPress
is, and it's a waste of time for those of us who don't speak Italian.
C'mon, pal, you can do much better than that!
--
Klaus Alexander Seistrup
Magnetic
implemented? Comparisons seem to work, but print'ing
doesn't:
#v+
1.0 0.5
True
print 1.23
%.*g
#v-
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
will be in the args variable.
Cheers,
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
without any problems, and I can start the Python
interpreter, but nothing happens if I ring in a Python expression and
press return -- the prompt just hangs and never returns.
Any ideas?
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http
= myline.split(EM_SPACE)
?
Cheers,
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
://pysqlite.org/.
Cheers,
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink.dk/
--
http://mail.python.org/mailman/listinfo/python-list
53 matches
Mail list logo