Reputation:
textData = "SENDER|%|SUB|%|HTML|%|username{*|*}password{*|*}mail{*|*}data1|*|username{*|*}password{*|*}mail{*|*}data1"
genelData = textData.split("|%|")
userData = genelData[3].split("|*|")
for userDataTable in userData:
usersData = userDataTable.split("{*|*}")
self.response.out.write("<br>" + usersData[2])
in this code i try to parse some string data.But when i try to print "usersData" variable everything looks fine.But when i tried to use like "usersData[2]" im getting list index out of range problem.
Upvotes: 0
Views: 460
Reputation: 5473
You should re-evaluate some of your identifiers...having 'userData' and 'usersData' in the same scope is a recipe for trouble.
Having said that, are you sure you aren't inadvertantly trying to print userData[2]
instead of usersData[2]
? I replaced your call to response.out.write
with a simple print statement, userData[2]
produced an index error while usersData[2]
worked fine.
Upvotes: 1