[24]: 'en_US.UTF-8'
In [25]: locale.format('%d', 1890284, True)
Out[25]: '1,890,284'
It's not always commas but whatever character is used to group thousands
in the active locale.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
)
Out[19]: datetime.datetime(2006, 8, 12, 10, 13, 56, 609000)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Antoon Pardon wrote:
On 2006-07-28, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
This avoids the problem but you get others in return. And it's an
abuse of `__slots__` which is meant as a way to save memory if you need
really many objects of that type
it in UTF-8 and then Base64. AFAIK the only reliable way to put an
arbitrary string into XML and get exactly the same string back again.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, file)
Yes that would work.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
`shelve` by the way?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
a party of characters and load them back
together than pickle a list with those characters. If you want a database
of many characters the player can choose from than you might want to store
them in a `shelve`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
Here is my script:
from mechanize import *
from BeautifulSoup import *
import StringIO
b = Browser()
f = b.open(http://www.translate.ru/text.asp?lang=ru;)
b.select_form(nr=0)
b[source] = hello python
html = b.submit().get_data()
soup =
describe you problem a little better. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Philippe Martin wrote:
Marc 'BlackJack' Rintsch wrote:
And now please describe you problem a little better. ;-)
I'll try.
first of all python is not going to be used for my purpose (sigh)
I have device A which holds a binary coded decimal array [N1,N2,Nn
In [EMAIL PROTECTED], Rob Sinclar
wrote:
Synaptic is using aptitude as back-end (this is serious).
Why can I deinstall aptitude without deinstalling synaptic then!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
without
X server installed.
I know what aptitude is…
Synaptic is the interface which leads the underlying application.
…but I ask why I can deinstall it and still use synaptic if it's using
aptitude as back-end as you seriously claim!?
Ciao,
Marc 'BlackJack' Rintsch
--
http
', 'w')
for line in in_file:
out_file.write(line)
in_file.close()
out_file.close()
how do you do ?
I'm fine, thanks. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
have: (1 billion)^2 bytes
You want: terabyte
* 100
/ 1e-06
Hope you have enough memory. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
aren't backed by empirical data either but often seems to be just learned
by heart in Java and C++ courses.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
:
x.bar = 'foo'
This avoids the problem but you get others in return. And it's an abuse
of `__slots__` which is meant as a way to save memory if you need really
many objects of that type and not as protection.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
you mind that the third entry has a 6 as unique
`auto` value? Doesn't `AUTO_INCREMENT` just guarantee unique values?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
separately.
Looking at the subject I would expect to be able to give 76°04'54 as
argument. Hm, but degrees don't map directly to hours!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
a memory problem read the documentation about
`__slots__`. But I would only consider this if `a lot of` is several 100k
or millions of objects and the memory consumption really is a problem.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of
them per program run, say in a CGI script, then a database will become
faster than linear searching through a csv file.
Just try both and measure to know for sure.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
tree.first('p')
p class=contentBodyFOO a name=f/a /p
So if I run 'print tree.first('p').string' to get the 'FOO' string it
shows Null value because it's the 'a' tag:
print tree.first('p').string
Null
Any solution?
In [53]: print tree.first('p').contents[0]
FOO
Ciao,
Marc 'BlackJack
In [EMAIL PROTECTED], paul kölle
wrote:
Marc 'BlackJack' Rintsch wrote:
In [EMAIL PROTECTED], Yacao Wang
wrote:
However, type signatures are not only a kind of information provided for
the compiler, but also for the programmer, or more important, for the
programmer. Without it, we have
write CSS into
Python programs. I guess there's a web framework involved? Or CGI?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
length.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
?
What is `length`? Do you want unique elements from `possible_notes`?
Then you could use `random.sample()`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
('test2.csv', 'wb')
writer = csv.writer(out_file)
for row, identical_rows in groupby(data):
row.append(len(list(identical_rows)))
writer.writerow(row)
out_file.close()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
on the image
format how much of the file has to be read and how the information is
encoded.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
but an object that implements the behavior of an
iterable. You can't check that reliable without actually trying to
iterate over it. Search for duck typing.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
by `f` itself according
to your protocol.
Put the original exception as an attribute to the new one and/or subclass
the new exception type from `E`. This way calling code can choose to to
handle both types as `E` if the distinction is not important.
Ciao,
Marc 'BlackJack' Rintsch
then. The language is obviously
not bondage enough for your needs.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of Python.
Can you flesh out your use case a little bit and tell why you can't solve
the problem with inheritance or a meta class?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
) is [None]
Wow it even gets better, the list containing one `None` object should be a
singleton too. Argh.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
and re.DOTALL when compiling the regular
expression.
You'll have to check the 'baro' and 'na' groups to decide if it matched a
numerical value or 'N/A'.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Boris Borcic wrote:
And I don't find `list(False)` to return an empty list be very obvious.
What would be your choice ?
``list()`` or ``[]`` for empty lists and a `TypeError` for
``list(False)``. Just like it is right now.
Ciao,
Marc 'BlackJack' Rintsch
`cfgparse`. Diez suggestet the `ConfigParser` modul. You notice the
difference?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
it is
god's chosen way of doing this ;-)
Pete doesn't like to be called god in public. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
get_all_children(self, accumulator=None):
if accumulator is None:
accumulator = list()
accumulator.extend(self.children)
for child in self.children:
child.get_all_children(accumulator)
return accumulator
Ciao,
Marc 'BlackJack' Rintsch
6.06.
There's a `python2.3` package with version 2.3.5 and a `python2.2` with
version 2.2.3 in it. All of them can be installed side by side.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
permission from
you.
The only secure way is to put the software on a server under your control
and offer your program as web service.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Daniel Nogradi
wrote:
More precisely I have a module m with some content:
# m.py
class A:
pass
class x( A ):
pass
class y( A ):
pass
# all kinds of other objects follow
# end of m.py
and then in another module I have currently:
# n.py
import m
to be present in the font that is used. Fonts that should
contain almost all mathematical characters are in the `latex-xft-fonts`
package.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
is
implemented but you might have a look at it.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
question, can the document object be turned/translated into a string
var?
…then yes: ``str(s)``
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], sfo wrote:
how do i create a hash of hash similar to perl using dict in python
$x{$y}{z}=$z
Just put dictionaries as values into a dictionary.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
://www.bittorrent.com/bittorrentecon.pdf
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
?
If there is a GIL then maybe yes. But the GIL is an implementation
detail. It's not in Jython nor IronPython and maybe not forever in
CPython. Don't know about PyPy.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. If you just call `show_ui()` you should get some windows.
The ``global`` is unnecessary by the way. It even generates a warning:
test.py:0: SyntaxWarning: name 'root' is assigned to before global
declaration
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
['Contacts']['Class']
Output is: IPF.Contact
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of the website with just HTTP. So you need a JavaScript
solution I guess. Send the end time as UTC time to the browser an use
JavaScript's `Date` object to display the countdown in local time.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
no effect on the real locals.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
You can get rid of the indexes and make the code a bit clearer by the way:
for old, new in find:
data = data.replace(old, new)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
*why* it failed.
For example because he has no rights or the file system is full.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to the
`interClassCall()`?
class B(object):
def interClassCall(self, c):
print c.a.a()
class C(object):
def __init__(self):
self.a=A()
self.b=B()
def c(self):
self.b.interClassCall(self)
Much less magic involved this way.
Ciao,
Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], arvind wrote:
i've created the myclass instance and calles the function second().
i want to access the text entered in 'w' through Entry widget in
function third()
i am getting the 'fuction not having 'w' attribute error.
how to overcome it?
Make `w` an attribute of
with a ''. in html, the
'nbsp;' char is not a valid ascii char...
in perl, i'd do 's /nbsp;//' and be done with it!!!
And in Python I'd use the `replace()` method on strings and be done with
it!!!
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
that automagically converts
*anything* to text? What about pictures?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], K.S.Sreeram
wrote:
Marc 'BlackJack' Rintsch wrote:
But why use a metaclass? If the meta class is only applied to *one*
class, can't you do at class level whatever the metaclass is doing!?
The very fact that you can put a loop inside __metaclass__ may be reason
enough
.
Yes, but setting properties works only with new-style classes. So I use
them whenever I use properties. In my mind properties and new-style
classes are linked together.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], bruce wrote:
does python provide regex handling similar to perl. can't find anything in
the docs i've seen to indicate it does...
The `re` module handles Perl compatible regexes.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
of defining a separate metaclass function/class, you can do
it inline. isn't that cool?
But why use a metaclass? If the meta class is only applied to *one*
class, can't you do at class level whatever the metaclass is doing!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
]
-
exceptions.IndexErrorTraceback (most recent call last)
/home/marc/ipython console
IndexError: list index out of range
So from the traceback it seems that `i` has a value that's not between 0
and ``len(d_list_code)``.
Ciao,
Marc 'BlackJack' Rintsch
--
http
(before dot) is not quoted, and
resulting string is not 8bit clean.
Why should a simple ASCII 'a' be quoted? And what do you mean by not
8bit clean? The string is even 7-bit clean!
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, it
does not contain the unicode character u'\xd8'. From the traceback it
seems your terminal uses `cp437` as encoding.
As you can see here: http://www.wordiq.com/definition/CP437 there's no Ø
in that character set.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
]:pattern.match('package TEST123 is xyz end;')
Out[13]:_sre.SRE_Match object at 0x405b15f8
I have copy and pasted you code.
For debugging re's in Python you might take a
look at http://kodos.sourceforge.net/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Dan Stromberg wrote:
What's the deal here?
Very hard to tell without more details.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Pekka Karjalainen wrote:
Suppose I had no idea what sys.stdout.closed was and wanted to find out.
Where would I look it up?
`sys.stdout` is a file (like) object:
http://docs.python.org/lib/bltin-file-objects.html
Ciao,
Marc 'BlackJack' Rintsch
--
http
In [EMAIL PROTECTED], bryan rasmussen
wrote:
It should hopefully be as high level as Wget, not download the pages
but just follow the links, and output graphs.
How do you get at the links without downloading the page!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
print dbapi2.version
db = dbapi2.connect(bla.db)
c = db.cursor()
c.execute(create table b (c integer))
for i in xrange(1000):
c.execute(insert into b values (%d) % i)
Just a guess: Commit the changes from time to time.
Ciao,
Marc 'BlackJack' Rintsch
--
http
In [EMAIL PROTECTED], aum wrote:
On Mon, 19 Jun 2006 14:45:19 +0800, Thomas Moore wrote:
http://www.python.org/pyfcp
It gets me to Error 404.
Apologies - that URL should have been:
http://www.python.org.nz/pyfcp
I get: Unknown host www.python.org.nz
Ciao,
Marc 'BlackJack
an already imported module doesn't reload
the module.
2) Once I assign mymodule.test with override, will modules that
imported my module *PRIOR* to the assignment get override, or will they
keep the original function test()?
They see the `override()` function.
Ciao,
Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Cameron Laird wrote:
In article [EMAIL PROTECTED],
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
In [EMAIL PROTECTED],
rsutradhar_python wrote:
date1=2006-01-10
date2=2005-12-15
date = date1 - date2
should give me 25 but problem is that date1 and date2 datatype
.
And don't mix up weakly and dynamically typed. Python is dynamically and
strictly typed.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
which i am not able
to do so please help me.
from datetime import date
date_str_1 = '2006-01-10'
date_str_2 = '2005-12-15'
date_1 = date(*map(int, date_str_1.split('-')))
date_2 = date(*map(int, date_str_2.split('-')))
print (date_1 - date_2).days - 1
Ciao,
Marc 'BlackJack' Rintsch
++ in Python. Take a step back and
describe *what* you want to achieve and not *how* you do it in another
language. And then implement it in Python.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
' % i
.7.:return functions
.7.:
In [8]:for function in pitfall():
.8.:print function()
.8.:
pitfall: i=2
2
2
2
At the time the list with the functions is returned `i` is 2. So if you
call any of the functions it looks up this `i`.
Ciao,
Marc 'BlackJack
]:binascii.unhexlify('ea523a664dabaa4476d31226a1e3bab0')
Out[27]:'\xeaR:fM\xab\xaaDv\xd3\x12\xa1\xe3\xba\xb0'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
when the lambda *definition*
is executed but when the lambda function is called. And then `i` is
always == `n`. You have to explicitly bind it as default value in the
lambda definition:
polys.append(lambda x, i=i: polys[i](x)*x)
Then it works.
Ciao,
Marc 'BlackJack
threads. If your task is
computational intensive then it may be better to use processes and some
form of inter process communication.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
]:'foo.txt'
In [8]:file('x')
---
exceptions.TypeError Traceback (most recent call last)
/home/bj/ipython console
TypeError: 'str' object is not callable
Ciao,
Marc 'BlackJack' Rintsch
--
http
. You can get an MD5 `HashAlgorithm` object this way::
HashAlgorithm algorithm = HashAlgorithm.Create(MD5);
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of the operating system you're using. On Unix, you can seek to a specific
place in a file, write a single character, seek to EOF, and you've done an
in-place single character edit of the file.
Why seeking to EOF after writing the byte?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
. :-)
SCNR,
Marc 'BlackJack' Rintsch
[1] http://www.cybersalt.org/cleanlaugh/images/03/ducktape.htm
--
http://mail.python.org/mailman/listinfo/python-list
was the possibility to
inherit from builtins. Inheriting from `open` looks quite strange.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
`
implementation.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
it was something like an NTP daemon that caused the clock to jump
a little and (Window's) sleep was confused.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
::
new_list = pipe(grep('larch'), grep('parrot', 'v')), list)(my_list)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
y, z
x.e(23)
def e(u, v):
print u, v
class B:
def e(v, w):
print 'spam', v, w
A.e = e
x = A()
x.a('answer', 42)
e('eric', 'viking')
A.a(x, 'ham', 'eggs')
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
that code.
Running this::
b = 3
def adding(a):
print a + b
adding(5)
Puts out 8 as expected.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
at termination,
which is what is happening.
From the Python side you can only control Python's input buffer but not
the output buffer of the external program you are starting. I guess that
programs buffers its output.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
``. There are no classes, just four objects. Convention in naming
and usage makes two of them something like templates or classes for new
objects but they are in no way special.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
1301 - 1400 of 1496 matches
Mail list logo