i have an error with this sample code i got from the net... the error says:
TypeError: unsupported operand types for +: 'int' and 'str'

here is the code:

from time import ctime

import codecs
import inbox, appuifw

box = inbox.Inbox()
msg = box.sms_messages()

f = codecs.open('E:/Others/listSMS.txt', 'w', 'utf8') # open file in UTF8
for i in msg:
f.write(box.address(i))
f.write('\n')
f.write(ctime(box.time(i))) # convert seconds in a string
f.write('\n')
f.write(box.content(i))
f.write('\n')
print i +"th SMS backed up" #<-- the error is here
f.close()

appuifw.note(u'All SMS are backed up!', "info")

f = codecs.open('E:/Others/listSMS.txt', 'r', 'utf8')
print f.read()
f.close()

Recommended Answers

All 2 Replies

Try
print str(i) +"th SMS backed up"

oh thanks... thank you very much.. :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.