I need to print [something] only one time, even if exactly the same string occurs next time. I tried this:
msg = "[something]" + random.randint(1,5)*str(random.randint(1,1000000000)) + "[something]"
i = msg[msg.index('['):msg.rindex(']')+1]
print i
but it works wrong. Message is prints up to last "]", I would like it to be up to the first "]". Between two "[something]" is randomly amount of strings. Is it posible with this code?