By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,706 Members | 1,298 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,706 IT Pros & Developers. It's quick & easy.

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

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

Any help will be appreciated;

Thanks

Expand|Select|Wrap|Line Numbers
  1. import string
  2.  
  3. template_text = '''
  4.     Delimiter : %%
  5.     Replaced  : %with_underscore
  6.     Ignored   : %notunderscored
  7. '''
  8.  
  9.  
  10. d = { 'with_underscore' : 'replaced',
  11.       'notunderscored'  : 'not replaced'    
  12.     }
  13.  
  14. class MyTemplate(string.Template):
  15.     delimiter = '%',
  16.     idpattern = '[a-z]+_[a-z]+'
  17.  
  18. t = MyTemplate(template_text)
  19. print 'Modified ID pattern:'
  20. print t.safe_substitute(d);
  21.  
Nov 7 '12 #1
Share this Question
Share on Google+
2 Replies

bvdet
Expert Mod 2.5K+
P: 2,851
Get rid of the comma after
Expand|Select|Wrap|Line Numbers
  1.     delimiter = '%',
Nov 7 '12 #2

P: 2
ok, I am too careless, Thanks
Nov 7 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.