No. Not so.
Observe, please:
Python 2.5.2 (r252:60911, May 7 2008, 15:19:09)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 1.2.2 ==== No Subprocess ====
>>> import math
>>> math.sqrt(1054.12)
32.467214232206615
>>> s = 'supercalifragilisticexpialidocious'
>>> s
'supercalifragilisticexpialidocious'
>>> len(s)
34
>>>
Have you by any chance assigned the function len to something else?
Otherwise, it should work really well. If you do help(len) in the
shell, wha dos it tell you.
Robert
Joshua Nikkel wrote:
I've
pasted the following from my python shell. Please note that the first
two lines of code are taken directly from the standard tutorial files
under section 3.1.2.
Will someone please tell me why something as basic and straightforward
as this will not work? Everything else seems to work just fine, but
not this. All I need is someway to get the length of a string...
please help,
nosh
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
Type "copyright",
"credits" or "license()" for more information.
****************************************************************
Personal
firewall software may warn about the connection IDLE
makes to its
subprocess using this computer's internal loopback
interface.
This connection is not visible on any external
interface and
no data is sent to or received from the Internet.
****************************************************************
IDLE 1.2.2
==== No Subprocess ====
>>> s =
'supercalifragilisticexpialidocious'
>>> len(s)
Traceback (most
recent call last):
File
"<pyshell#1>", line 1, in <module>
len(s)
TypeError: 'str'
object is not callable
>>> s
'supercalifragilisticexpialidocious'
>>> len(s)
Traceback (most
recent call last):
File
"<pyshell#3>", line 1, in <module>
len(s)
TypeError: 'str'
object is not callable
>>>
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor
|
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor