?
Not the whole file is read but a block of it. If you type in enough to
fill the buffer the iteration can start without an EOF on `sys.stdin`.
See the second example in [EMAIL PROTECTED] which
demonstrates that not the whole file is read at once by the iterator.
Ciao,
Marc 'BlackJack
. And some modules are already
imported before your module is imported because they are built-in or
loaded to be able to import your module in the first place. And what
about modules that are written in C?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
x
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
an integer with the number of affected rows.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
package installed?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
The homogeneous objects in lists must not be of the same type but share
some behavior so it makes sense to apply some operation on all the
elements. For example get the length of each item or sum them all up.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
shotty inactive icons in
the Windows Classic Theme?
ANY help appreciated.
What the heck are you talking about? Tkinter?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
not without
moving all following data down, but then the file pointer within
`gstreamer` is wrong. Can't `gstreamer` be fed through a pipe?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
are used for. Untested:
f = open('dump.txt', 'wb')
p = Popen(('mysqldump', '--option', '--another-option'), stdout=f)
r = p.wait()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
thread program?
If you want wall time then use `time.time()` in the `run()` method of the
threads to calculate the difference between start and end and set an
attribute with the elapsed time on the `MyThread` objects.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
but that you simply print the
string representation of the list which does not meet your requirements.
You want to join the list elements with a comma::
print 'supported=%s' % ','.join(ser)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()` is reading from `stdin` so the very first
line you pipe in will be assigned to `bucket_name`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
expressions:
def main():
soup = BeautifulSoup(source, convertEntities=BeautifulSoup.HTML_ENTITIES)
print ' '.join(''.join(soup(text=True)).split())
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
behaviour to them.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()
if not line: break
# do something with the line of text such as print it.
f.close()
f = open(r'pathToFile)
for line in f:
# do something with the line of text such as print it.
f.close()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], kevinliu23
wrote:
2a 3ab into -2a -3ab.
In [8]: '-' + ' -'.join('2a 3ab 4xy'.split())
Out[8]: '-2a -3ab -4xy'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
instance variable, not class variables.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
( ) and msvcrt.getch( ). Is there
something equivalent to wait for string inputs?
The builtin `raw_input()`?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
make sense to encode a string in 'latin-1' because it must be
decoded first and the automatic decoding assumes ASCII and barfs if
there's something non-ascii in the string.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of this be? Shouldn't shutil simply be
reading and writing the bytes and not character decoding them?
Do you really get this error from the code above or just in the real
program? Are the paths hard coded in the real program too?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
In [EMAIL PROTECTED], Mark Morss
wrote:
Well, the discussion was about Python vs. Fortran, and Pyrex, as I
understand it, is a tool for linking C to Python.
I think it's more than that. It's more a subset of Python with a little
static typing.
Ciao,
Marc 'BlackJack' Rintsch
--
http
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Marco wrote:
I want to set SA_RESTART flag to restart a system-call. How to do
this in Python?
You question seems to lack a little bit context. Are you talking about
system calls into the Linux kernel?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
to make 'tmp' a copy
of First, I tried using copy.copy and copy.deepcopy, but that doesn't
work.
P.S.
Yes, I can do a:
class tmp(First):
pass
but I'd rather make a copy than a subclass.
Why? Python isn't a prototype based programming language.
Ciao,
Marc 'BlackJack
In [EMAIL PROTECTED], Beliavsky
wrote:
[…] How should one check that files are the same in Python? The files
are plain text.
Take a look at the `filecmp` module. Pay attention to the shallow
argument of `filecmp.cmp()` and the default value!
Ciao,
Marc 'BlackJack' Rintsch
--
http
`time.sleep()` into the loop.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
And if the names give the right hints `db.sync()` may be a potentially
expensive operation. Try to call it at a lower frequency if possible.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
forces the changes
to be written to disks, so all caching and buffering of the operating
system is prevented. So this may slow down the program considerably.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
://www.diveintopython.org/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
):
self.i_am_an_instance_attribute = 'Viking'
And C++static local variables don't exist in Python. There are ways to
emulate them with mutable default arguments, but that's at least
debatable. Use a class instead.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
at 0xb5a3fd4c
In [44]: x()
Out[44]: __main__.DemoClass object at 0xb5a3fc2c
You have to call the class object and the method to see any effects.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], skip wrote:
Are you sure? There's no guarantee that an iterator will terminate:
len(list(itertools.cycle(range(10
You have infinite memory? ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], dmitrey wrote:
how can I implement this one in the simpliest way?
Thank you in advance,
In [45]: '%10d' % 1
Out[45]: ' 1'
In [46]: '%10d' % 42
Out[46]: '42'
In [47]: '%10d' % 1
Out[47]: ' 1'
Ciao,
Marc 'BlackJack' Rintsch
--
http
(Memtotal:):
name, amt, unit = line.split()
print name, amt, unit
break
Of course it's cleaner to assign the file object to a name and close the
file explicitly after the loop.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of an object.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
So those editors have some problem with XML. I'm not impressed
by such code. ;-)
It's like complaining about:
In [100]: '\x61'
Out[100]: 'a'
It's the same information, just a different representation. Both are
within the specs.
Ciao,
Marc 'BlackJack' Rintsch
--
http
but also on the file system
in use.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
refuses to guess.
If an encoding could be determined the `sys.stdout.encoding` attribute is
set to the name, otherwise it's `None`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Raymond
Hettinger wrote:
On Mar 9, 7:32 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
In [EMAIL PROTECTED], cesco wrote:
Given two positive integers, N and M with N M, I have to generate N
positive integers such that sum(N)=M. No more constraints.
Break
to generate (N-1)
random numbers that add up to (M-X). You have to think a little bit about
the suitable range part though.
The necessary functions to draw random numbers are in the `random` module.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
). Is
that right?
Yes, that's correct.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], israphelr
wrote:
So I created a program, that gets a string from a user and then prints
the string in reverse order.
In [57]: 'reversed string'[::-1]
Out[57]: 'gnirts desrever'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
state/data and related functions into one object
is a key concept of OOP.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
) with the original
`heapq` module.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
CantDoIt
--
Why do you think this is an abuse? I think it's a perfectly valid use of
a loop.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
by a
`StopIteration` exception. Looks like flow control to me.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], bg_ie wrote:
Therefore, how do I build the tuple of Falses to reflect the length of
my t tuple?
In [1]: dict.fromkeys(('one', 'two', 'three'), False)
Out[1]: {'three': False, 'two': False, 'one': False}
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
In [21]: a
Out[21]: {'two': {'x': 42}, 'one': {'x': 42}}
In [22]: a['one'] is a['two']
Out[22]: True
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the ``+`` operator to return either an immutable or
entirely new object, while `add()` can be something on containers that
mutates the object.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. ;-)
SCNR,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
and
falseness.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
%
Compared to what? Compared to a sort that doesn't do what you want?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
way to
give some information in stack traces or when doing introspection.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Bjoern Schliessmann wrote:
Michele Simionato wrote:
On Mar 1, 9:40 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED]
In [EMAIL PROTECTED], Bjoern Schliessmann
But what's it (__name__) good for?
As objects don't know to which name they are bound, that's a good
way
not interested to change xml file.)
They have been created because the text is in the XML source. Line breaks
are valid text.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
for the `description` attribute of cursors? Section
`Cursor Objects`:
http://www.python.org/dev/peps/pep-0249/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()['SomeClass'] vs. some_dict['SomeClass']) and you
don't risk that some of your dynamically created classes overwrites an
existing one with the same name.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
also has APIs for such things
that work cross platform it might be better to use those, because you can
separate GUI and logic better. It's hard to replace the Qt libraries with
a Gtk, wxPython or web GUI if you still need Qt for networking or database
access.
Ciao,
Marc 'BlackJack' Rintsch
or after the ISBN, there just have to be at
least one. BTW with the star it even matches *no* non-digit too!
So the re looks like this: '\D(\d{10}|\d{9}X)\D'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
not expect changes to that package.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
checkfile(filename):
f = codecs.open(filename,encoding='ascii')
try:
for num, line in enumerate(f):
pass
except UnicodeError:
print 'problem: line %d' % num
f.close()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
installing an uninstalling software is:
If you don't know what it does and…
1. …it is not installed then don't install it.
2. …it is installed then don't uninstall it.
Or things may break.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], James Stroud wrote:
Better would be to remove windows xp and get another operating system.
Yeah XP is sooo ooold, the OP should install Vista. Or did you mean a
real OS instead of just another one? ;-)
SCNR,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
no effect on the loop test. Which IMHO is a good thing.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
://effbot.org/pyfaq/installed-why-is-python-installed-on-my-machine.htm
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, but with a list comprehension::
result = [the_dict[key] for key in ('row1', 'row2', 'row3')]
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
* memory address unless you run DOS. Modern
operating systems tend to use some virtualisation of memory. :-)
What's your goal? What do you expect at the memory address you want to
access?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
With some number:
In [2]: % 3s % 'a'
Out[2]: ' a'
The space still doesn't have any effect here:
In [66]: %3s % 'a'
Out[66]: ' a'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
/Cookbook/Python/Recipe/415504
And a library called `poker-eval` with Python bindings:
http://pokersource.org/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
]: fnmatch.translate('.??[oOdDnNmM]*')
Out[8]: '\\...[oOdDnNmM].*$'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of printing it from within the
main without creating an object of the MyClass type. I need to assign
the name of the class within my script, to a variable in main.
Yes::
print MyClass.__name__
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Gosi wrote:
I like to use J for many things and I think that combining Python and
J is a hell of a good mixture.
I was able to follow this sentence up to and including the word hell… :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
'hello WORLD', but s is no longer
myStr, it's a regular str!
What can I do?
Return a `myStr` instance instead of a regular `str`:
def hello(self):
return myStr('hello ' + self)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED],
karoly.kiripolszky wrote:
and the great thing is that the algorithm can be used with any
language that structures the code with brackets, like PHP and many
others.
But it fails if brackets appear in comments or literal strings.
Ciao,
Marc 'BlackJack' Rintsch
like Python's list type.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
On Feb 3, 2:16 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
In [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
pygame is probily a good program to start with as long as you keep in
mind that it is possible that up to 50% of the p.c
In [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
pygame is probily a good program to start with as long as you keep in
mind that it is possible that up to 50% of the p.c. laptops may not be
able to run it.
Huh? Care to explain this?
Ciao,
Marc 'BlackJack' Rintsch
--
http
without a regular expression.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Tony Houghton wrote:
In Linux it's possible for filesystems to have a different encoding from
the system's setting. Given a filename, is there a (preferably) portable
way to determine its encoding?
No.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
operator
operator.div(14, 7)
:-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Krypto wrote:
The correct answer as told to me by a person is
(N3) + ((N-7*(N3))3)
How could it be correct if it uses `-`? You ruled out `-` and `/` in your
first post.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
for args in zip(list[1:], color[1:]):
plot(*args)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the integer literal and the dot operator works too:
In [1]: 2 .__add__(1)
Out[1]: 3
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.with_statement
_Feature((2, 5, 0, 'alpha', 1), (2, 6, 0, 'alpha', 0), 32768)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Fabrice DELENTE wrote:
As support for 8-bit (and even unicode) is important for my script, is there
any hope? Should I switch to slang instead of curses?
Take a look at urwid:
http://excess.org/urwid/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
Out[5]: _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
In [6]: help(__future__)
snipped help output
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
a list or dictionary but some object
that *acts* like a list or dictionary. Or you even expect just some
aspects of the type's behavior. For example that it is something you can
iterate over.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
exactly are you doing? How does a (unicode?) string look like that
triggers this exception?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
even simpler: cursor objects are iterable after the `execute()`
call. So you don't need the number of rows::
gert.excecute('select * from person')
for row in gert:
print row
gert.close()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
that TABs are messed up, which is not a
problem with other languages, but is a problem with Python. Too bad.
Well then don't use code from people using TABs. If it's indented by four
spaces per level, like suggested by the style guide, there's no problem
with TABs.
Ciao,
Marc 'BlackJack
In [EMAIL PROTECTED], hg wrote:
Is there a way to do that ?
Maybe this helps:
http://paste.pocoo.org/show/316/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], raghu wrote:
what is standard streams in case of python?
Do you mean `sys.stdin`, `sys.stdout` ans `sys.stderr`?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
1001 - 1100 of 1496 matches
Mail list logo