see the 3 small piece of code, i cannot understand why it result as
this.
1.
def test():
abc="111"
def m1():
print(abc)
m1()
test()
Output: 111
2.
def test():
abc="111"
def m1():
print(abc)
abc+="222"
On Sep 5, 8:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> neoedmund schrieb:
>
> > for example:
>
> > X.py is in aaa.bbb and it has a line like "import aaa.bbb.Y"
> > how can I run X.py avoiding it saying such like "ImportError:
for example:
X.py is in aaa.bbb and it has a line like "import aaa.bbb.Y"
how can I run X.py avoiding it saying such like "ImportError: No
module named aaa.bbb"?
Is all runnable script must be in the default package?
thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 7, 4:07 pm, gu <[EMAIL PROTECTED]> wrote:
> hi to all!
> after two days debugging my code, i've come to the point that the
> problem was caused by an unexpected behaviour of python. or by lack of
> some information about the program, of course! i've stripped down the
> code to reproduce the
i want to let a byte array to be xor with some value.
but code show below i wrote seems not so .. good..., any better way to
write such function? thanks.
[code]
def xor(buf):
bout=[]
for i in range(len(buf)):
x = ord(buf[i])
x ^= 123
b
I'm more familiar with java. maybe java.util.Calendar can be port to
python? i donnt know.
mthorley のメッセージ:
> Greetings, I'm looking for a python module that will take a datetime
> obj and convert it into relative time in english.
> For example: 10 minutes ago, 1 Hour ago, Yesterday, A few day a
Bruno Desthuilliers wrote:
> neoedmund wrote:
> (snip)
> > So I can reuse a method freely only if it's worth reusing.
> > For the word "inheritance", in some aspect, meanings reuse the super
> > class, with the condition: must reuse everything fr
Bruno Desthuilliers wrote:
> neoedmund wrote:
> (snip)
> > So I can reuse a method freely only if it's worth reusing.
> > For the word "inheritance", in some aspect, meanings reuse the super
> > class, with the condition: must reuse everything fr
gel wrote:
> I would like to write some data recovery software as a learning thing.
> The sort of thing that you would use to recover data from a currupt HDD
> or floppy etc. I would like to be pointed in the right direction as
> far as modules to use and suggested approaches.
what kind of recov
On Oct 16, 9:01 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> neoedmund wrote:
> > Bruno Desthuilliers wrote:
> >> neoedmund wrote:
> >> (*PLEASE* stop top-posting - corrected)
> >>> Ben Finney wrote:
> >>>> [P
Bruno Desthuilliers wrote:
> neoedmund wrote:
> (*PLEASE* stop top-posting - corrected)
> >
> > Ben Finney wrote:
> >> [Please don't top-post above the text to which you're replying.]
> >>
> >> "neoedmund" <[EMAIL PROTECTED]>
Oh, How great is the solution! ( though i don't know how it works. )
Thank you George.
George Sakkis wrote:
> neoedmund wrote:
>
> > python use multiple inheritance.
> > but "inheritance" means you must inherite all methods from super type.
> > now i jus
I found a dynamic way to inherite classes:
def MixIn(pyClass, mixInClass):
if mixInClass not in pyClass.__bases__:
pyClass.__bases__ += (mixInClass,)
def test1():
o = C3()
MixIn(C3,C1)
MixIn(C3,C2)
o.m()
"expected aaa"
neoedmund wrote:
&
nheritance?
Ben Finney wrote:
> [Please don't top-post above the text to which you're replying.]
>
> "neoedmund" <[EMAIL PROTECTED]> writes:
>
> > I'm trying to achieve a higher level of "reusability". Maybe it
> > cannot be done
I'm trying to achieve a higher level of "reusability". Maybe it cannot
be done in python? Can anybody help me?
Ben Finney wrote:
> "neoedmund" <[EMAIL PROTECTED]> writes:
>
> > There's a program, it's result is "unexpected aaa
thank you, Kay.
But i need a "dynamic" way. Say i have a existing class, and add some
method from other class into it.
Kay Schluehr wrote:
> neoedmund wrote:
> > There's a program, it's result is "unexpected aaa", i want it to be
> > "
There's a program, it's result is "unexpected aaa", i want it to be
"expected aaa". how to make it work?
[code]
class C1(object):
def v(self, o):
return "expected "+o
class C2(object):
def v(self, o):
return "unexpected "+o
def m(self):
python's time is as old as glibc's time(). A more clear interface as
Java should be implements! though i'm not has the ability to do this.
maybe some "volenties" could do out the favor.
On Oct 11, 10:38 pm, [EMAIL PROTECTED] wrote:
> Hi all
>
> How can I access partial seconds on the system cloc
nt s
return unicode( s )
#print repr( getStamp() )
def test():
subject = decode_header( "=?UTF-8?B?5rWL6K+V?=" )
print "s1=", repr( subject )
t1 = subject[0][0]
print "t1=", repr( t1 )
fn = "%s/%s-%s.mail"%( &
/**
* Returns the current time in milliseconds. Note that
* while the unit of time of the return value is a millisecond,
* the granularity of the value depends on the underlying
* operating system and may be larger. For example, many
* operating systems measure time
;ascii' codec can't decode byte 0xe6 in position 0:
ordinal not in range(128)
So "str"%(param) not accept unicode, only accept byte array?
John Machin wrote:
> neoedmund wrote:
> > i want to get the subject from email and construct a filename with the
> > s
i want to get the subject from email and construct a filename with the
subject.
but tried a lot, always got error like this:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 4:
ordinal not in range(128)
msg = email.message_from_string( text )
title = decode_hea
myself wrote a multipart parser in java(i customise it because i need
get information of "upload progress"). and i think it's also easy to
implement in python, i've not have time done it, or i'll post it.
but if you're no other special needs, just use email lib, it's quick to
program and if you rea
yeah, java also have 2 interface, Comparator and Comparable, which
equal to python's compareTo() and __cmp__()
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Tom Cole wrote:
>
> > In Java, classes can implement the Comparable interface. This interface
> > contains only one method, a com
So what? Java 5.0 has the method, why python has not?
Bruno Desthuilliers wrote:
> neoedmund wrote:
> Please repeat the whole question in the message body
>
> =>how to get the os file icon for a given content-type?
> > any simple method?
>
> This is specific to your OS
any simple method?
--
http://mail.python.org/mailman/listinfo/python-list
26 matches
Mail list logo