AttributeError: 'tuple' object has no attribute 'join'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TalHuang
    New Member
    • Nov 2012
    • 2

    AttributeError: 'tuple' object has no attribute 'join'

    Why this code return error
    AttributeError: 'tuple' object has no attribute 'join'

    Any help will be appreciated;

    Thanks

    Code:
    import string
    
    template_text = '''
        Delimiter : %%
        Replaced  : %with_underscore
        Ignored   : %notunderscored
    '''
    
    
    d = { 'with_underscore' : 'replaced',
          'notunderscored'  : 'not replaced'    
        }
    
    class MyTemplate(string.Template):
        delimiter = '%',
        idpattern = '[a-z]+_[a-z]+'
        
    t = MyTemplate(template_text)
    print 'Modified ID pattern:'
    print t.safe_substitute(d);
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Get rid of the comma after
    Code:
        delimiter = '%',

    Comment

    • TalHuang
      New Member
      • Nov 2012
      • 2

      #3
      ok, I am too careless, Thanks

      Comment

      Working...