Skip to content

Instantly share code, notes, and snippets.

@rokujyouhitoma
Created August 11, 2015 13:38
Show Gist options
  • Save rokujyouhitoma/1c8a7bab7a0061f5a776 to your computer and use it in GitHub Desktop.
Save rokujyouhitoma/1c8a7bab7a0061f5a776 to your computer and use it in GitHub Desktop.
text = "ab[ffffff]cd[-]ef"
print("length: {0}".format(len(text)))
#print(text[2])
indexes = [0,2,10,12,15,17]
for i in range(0, len(indexes) / 2):
sindex = indexes[i*2]
eindex = indexes[i*2+1]
print("s: {0}".format(sindex))
print("e: {0}".format(eindex))
for x in range(sindex, eindex):
current = text[x]
print("current: {0}".format(current))
next = None
if (sindex < x+1 < eindex):
next = text[x+1]
elif x+1 == eindex:
if not len(indexes) == i*2+2:
nextIndex = indexes[i*2+2]
next = text[nextIndex]
print("next: {0}".format(next))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment