What's wrong with my python? I can't use string

Frank Potter could.net at gmail.com
Tue Feb 10 08:13:24 CET 2009


I have a xxx.py which has code as below:

import string

print dir(string)
print string.printable


when I run it, I got the strange error:

"<?xml version=\"1.0\" encoding=\"gbk\"?>\n"
"<root>\n"
"<result>##result##</result>\n"
"<msg>##msg##</msg>\n"
"<pass_no>##pass_no##</pass_no>\n"
"<pot_num>##pot_num##</pot_num>\n"
"<pots_mashed>##pots_mashed##</pots_mashed>\n"
"<yb_used>##yb_used##</yb_used>\n"
"<right>##right##</right>\n"
"</root>\n"
['__builtins__', '__doc__', '__file__', '__name__', 'str']
Traceback (most recent call last):
  File "del2.py", line 4, in ?
    print string.printable
AttributeError: 'module' object has no attribute 'printable'

It seems that I did not import the right string module I want. Can
someone give me a clue, please?




More information about the Python-list mailing list