En/na Laszlo Nagy ha escrit:
> This program:
>
> import sys
> import traceback
> import cStringIO
>
> a = 1.0
> b = 0.0
> try:
>c=a/b
> except: f = cStringIO.StringIO('')
>ei = sys.exc_info()
>traceback.print_exception(ei[0],ei[1],ei[2],file=f)
from cStringIO documentation:
En/na xkenneth ha escrit:
> I want to be able to cycle through an array and print something in
> hexadecimal. Such as this
> thisArray = ["AF","0F","5F"]
> for x in range(len(thisArray)):
>print "\x" + thisArray[x]
>
> However python chokes on the escaped identifier, how can I get arou
En/na [EMAIL PROTECTED] ha escrit:
> Hi,
>
> I have a very simple problem, but do not know an elegant way to
> accomplish this.
> ###
> # I have a list of names:
> names = ['clark', 'super', 'peter', 'spider', 'bruce', 'bat']
>
> # and another set of names that I want to insert into
> # the names
En/na [EMAIL PROTECTED] ha escrit:
> does anyone know a module or something to convert numbers like integer
> to binary format ?
http://www.google.es/search?q=python+integer+to+binary
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/219300
> for example I want to convert number 7 to 0111
Not tested by me, but according to docs it does support list values:
http://cheeseshop.python.org/pypi/ConfigObj
Regards
--
http://mail.python.org/mailman/listinfo/python-list
Florian Lindner escribió:
> I think the best solution would be to use a seperation character:
>
> dir="/home/florian, /home/john, home/whoever"
RCS uses , in filenames
> What do you think? Any better ideas?
A bit ugly, but probably safer and simpler than adding arbitrary separators:
[section]
John Salerno escribió:
> Alexis Roda wrote:
>>
>> > The
>> > try block seems nicer because it doesn't have such an ugly-looking
>> check
>> > to make.
>>
>
> Why do you think that this try block is preferred over what I have (if I
&
John Salerno escribió:
> 2. Between the if block or the try block, which is more Pythonic?
Since the command line argument is optional I don't think it should be
considered and exceptional condition if it's missing, so the "if" block
looks better to me. No idea if this is more pythonic.
> The
Ben C escribió:
> On 2006-04-21, Ben C <[EMAIL PROTECTED]> wrote:
> Having said that, I attempted to confirm this using def rather than
> lambda, and encountered something I cannot explain at all-- it appears
> that the functions are getting redefined whenever they are called, to
> effect a kind of
[EMAIL PROTECTED] escribió:
> Hello,
>
> # the idea is now to give the definition of the multiplication of
> functions and integers
> # (f * c)(xx) := f(x)*c
> [lambda xx: f(xx)*y for y in range(1,5)][0](1)
> # returns 4
here lambda uses a variable defined outside of the lambda (y). Any
change m
Michael Yanowitz escribió:
> Hello:
>
>I ran the new pylint and my code and I had a few questions on why those
> are warnings or what I can do to fix them:
>
> 2) C: 0: Missing required attribute "__revision__"
>What is this? Is that for CVS? I don't use CVS (we use SVN). I have not
>
[EMAIL PROTECTED] escribió:
> I've been reading about Python Classes, and I'm a little confused about
> how Python stores the state of an object. I was hoping for some help.
>
> I realize that you can't create an empty place holder for a member
> variable of a Python object. It has to be given a v
Tim Chase escribió:
>
> [EMAIL PROTECTED] cd ~tim/WebStack-1.1.2
> [EMAIL PROTECTED] python2.3 setup.py install
> running install
> error: invalid Python installation: unable to open
> /usr/lib/python2.3/config/Makefile (No such file or directory)
>
apt-get install python2.3-dev
HTH
--
http
"
HTH
--
(@ @)
oOO(_)OOo--
<> Ojo por ojo y el mundo acabara ciego
/\ Alexis Roda - Universitat Rovira i Virgili - Reus,
14 matches
Mail list logo