Help to convert Number to String

Ben Finney ben+python at
Sat Aug 14 05:04:34 CEST 2010

Vamsi <vamsikrishna.bandlamudi at> writes:

> fileopen = open('C:/MPython/test.txt', 'r')
> str =

The above statement clobbers the existing binding of ‘str’ to the
built-in string type. From that point on, the built-in string type is no
longer accessible by the name ‘str’; that name accesses a different

Choose a better name for the return value; make it describe what the
value is for in the context of the program.

    in_file = open('C:/MPython/test.txt', 'r')
    in_file_content =
    print in_file_content
    # …

It also has the advantage of making your code more readable, since the
names help indicate *why* the code is written the way it is.

 \     “Creativity can be a social contribution, but only in so far as |
  `\            society is free to use the results.” —Richard Stallman |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list