[Tutor] Inputting elements of a list

Luke Paireepinart rabidpoobear at gmail.com
Mon Jan 22 10:43:01 CET 2007


vanam wrote:
> For standard input from the keyboard raw_input will be used for string 
> and input for number.Suppose i want to input a list of some elements 
> how could it be done. Actually i am looking for sorting out elements 
> in a list.Below is the given script
> list = [45,4,5]
> list.sort()

Don't call your lists 'list', or a character 'chr' or an int 'int'... 
These are all reserved keywords in Python and if you use them as 
variables you'll overwrite the builtins in that scope.
Example:

 >>> int = 1
 >>> int('1000')
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in ?
    int('1000')
TypeError: 'int' object is not callable


HTH,
-Luke


More information about the Tutor mailing list