Friday, 23 August 2013

Getting data for replacement (python 3.3)

Getting data for replacement (python 3.3)

For example, I have a string or a list of such strings:
text = '000 #-tags-2-7-# 001 002 003 004 05 06 07 08 SDFGSDFG #-tags-3-9-#'
keys = ['key-1', 'key-2', 'key-3', 'key-4', 'key-5', 'key-6', 'key-7',
'key-8', 'key-9', 'key-10']
and I need to replace #-tags-2-7-# on result from keys[randint(2, 7)] and
#-tags-3-9-# on keys[randint(2, 7)] etc. I need to get every time two
integers from #-tags---# and send it to keys[randint(*, *)] and send
result instead #-tags---#

No comments:

Post a Comment