js åé:
> AFAIK, nothing.
> How abount letting a browser do it?
> By using pamie [1] or selenium, you can drive a browser from python.
>
> [1] http://pamie.sourceforge.net/
>
> On Feb 2, 2008 11:07 AM, J. Peng <[EMAIL PROTECTED]> wrote:
>> hello,
>>
>
hello,
Which useragent lib supports javascript?
I know something about these libs: urllib,urllib2,cookielib,httplib
But I'm not sure which one of them can support javascript scripts.
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Is there a site for python,which collects most kinds of python modules?
like CPAN for Perl.
Sometime I want to use a module,like the time/date modules,don't know
where I should search from.
Sorry if I have repeated this question on the list.
Thanks!
--
http://mail.python.org/mailman/listi
Bruno Desthuilliers 写道:
> J. Peng a écrit :
>> def safe_float(object):
>> try:
>> retval = float(object)
>> except (ValueError, TypeError), oops:
>> retval = str(oops)
>> return retval
>
>> The code above works well.
>
> For whi
def safe_float(object):
try:
retval = float(object)
except (ValueError, TypeError), oops:
retval = str(oops)
return retval
x=safe_float([1,2,3,4])
print x
The code above works well.But what's the instance of "oops"? where is it
coming from? I'm totally confused on it.thanks.
--
ht
Gabriel Genellina 写道:
> En Tue, 22 Jan 2008 02:03:10 -0200, Paul Rubin
> <"http://phr.cx"@NOSPAM.invalid> escribió:
>
>> "J. Peng" <[EMAIL PROTECTED]> writes:
>>> print line,
>> Do you really want all the lines crunched toge
Thank you. That gave so much solutions.
And thanks all.
Steven D'Aprano 写道:
> On Tue, 22 Jan 2008 11:00:53 +0800, J. Peng wrote:
>
>> first I know this is the correct method to read and print a file:
>>
>> fd = open("/etc/sysctl.conf")
>> done=0
first I know this is the correct method to read and print a file:
fd = open("/etc/sysctl.conf")
done=0
while not done:
line = fd.readline()
if line == '':
done = 1
else:
print line,
fd.close()
I dont like that flag of "done",then I tried to re-write it as:
fd = open
Steven D'Aprano 写道:
> On Mon, 21 Jan 2008 16:23:50 +0800, J. Peng wrote:
>
>> J. Peng 写道:
>>
>>>k = (i.split())[3]
>>>y = (i.split())[1]
>> btw, why can't I write the above two into one statement?
>>
>> (k,y) = (i.split()
J. Peng 写道:
>k = (i.split())[3]
>y = (i.split())[1]
btw, why can't I write the above two into one statement?
(k,y) = (i.split())[3,1]
--
http://mail.python.org/mailman/listinfo/python-list
I tried to write it below,it can work,:)
v= """preference 10 host mx1.domain.com
preference 30 host anotherhost.domain.com
preference 20 host mx2.domain.com"""
x=v.split("\n")
li =[]
for i in x:
k = (i.split())[3]
y = (i.split())[1]
li.append((y,k))
li.sort()
print li
the output is:
Dennis Lee Bieber 写道:
> The scope of "name" is the entire function; lacking a "global name"
> statement, AND being on the left side of an assignment, it is a function
> local name.
Thank you. Does python have so-called 'block scope' object?
or if you can,please show me the doc for python's o
J. Peng 写道:
> Please see the code below,what's the scope for object "name"?
> I thought it should be located in the while block, but it seems not
> really,it can be accessed out of while (the db[name] statement).Thanks
> in advance.
>
>
sorry the before code
Please see the code below,what's the scope for object "name"?
I thought it should be located in the while block, but it seems not
really,it can be accessed out of while (the db[name] statement).Thanks
in advance.
db = {}
def newuser():
prompt = 'login desired: '
while 1:
name = raw_input(prompt)
Python's variable is dynamic type,is it?
But why this can't work?
>>> 3 + 'a'
Traceback (most recent call last):
File "", line 1, in ?
TypeError: unsupported operand type(s) for +: 'int' and 'str'
So I see the number 3 can't be converted to string type automacially.
--
http://mail.python.org/ma
> On Jan 18, 3:23 am, "J. Peng" <[EMAIL PROTECTED]> wrote:
>
>> what's the difference between an array and a list in python?
>> I see list has all features of array in C or perl.
>> so please tell me.thanks.
>>
>
> If you are n
thanks all!
On Jan 18, 2008 3:49 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Fri, 18 Jan 2008 13:55:17 +0800, "J. Peng" <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
> >
> > why this happened on my python?
> &g
hello,
why this happened on my python?
>>> a=3.9
>>> a
3.8999
I wanted 3.9 but got 3.89
How to avoid it? thanks.
this is my python version:
>>> sys.version
'2.3.4 (#1, Feb 6 2006, 10:38:46) \n[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)]'
--
http://mail.python.org/mailma
what's the difference between an array and a list in python?
I see list has all features of array in C or perl.
so please tell me.thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 17, 2008 2:55 PM, Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
>
> @$ref = (4, 5, 6) intentionally assigns to the same list pointed to by
> the reference. That would be spelled as x[:] = [4, 5, 6] in Python.
> What Python does in your example is assign the same as Perl's $ref =
> [4, 5, 6]. So
On Jan 17, 2008 1:54 PM, Mel <[EMAIL PROTECTED]> wrote:
>
> test(a) (along with def test(x)) takes the object named 'a' in the
> current namespace and binds it with the name 'x' in function test's
> local namespace. So, inside test, the name 'x' starts by referring to
>the list that contains [
On Jan 17, 2008 2:03 PM, Christian Heimes <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > Python's parameter passing is like passing a pointer in C/C++.
> [snip]
>
> It's not (I repeat NOT) like passing a pointer in C. Please read
> http://effbot.org/zone/call-by-object.htm
>
Yes I agree. No
May I ask, python's pass-by-reference is passing the object's
reference to functions, but perl, or C's pass-by-reference is passing
the variable itself's reference to functions. So althought they're all
called pass-by-reference,but will get different results.Is it?
On
I just thought python's way of assigning value to a variable is really
different to other language like C,perl. :)
Below two ways (python and perl) are called "pass by reference", but
they get different results.
Yes I'm reading 'Core python programming', I know what happened, but
just a little con
On Jan 16, 2008 3:03 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Wed, 16 Jan 2008 13:59:03 +0800, "J. Peng" <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
> > How to modify the array passed to the function? I tried somethi
On Jan 16, 2008 2:30 PM, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Wed, 16 Jan 2008 13:59:03 +0800, J. Peng wrote:
>
> > Hi,
> >
> > How to modify the array passed to the function? I tried something like
> > this:
> >
> >>>
On Jan 16, 2008 1:45 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Wed, 16 Jan 2008 11:09:09 +0800, "J. Peng" <[EMAIL PROTECTED]>
>
> alist = []
> anint = 2
> astr = "Touch me"
>
> dummy(alist, anint, astr)
>
> "
Hello,
I saw this statement in Core Python Programming book,
All arguments of function calls are made by reference, meaning that
any changes to these parameters within the function
affect the original objects in the calling function.
Does this mean there is not pass-values calling to a function
28 matches
Mail list logo