Let\'s say I have a string \'gfgfdAAA1234ZZZuijjk\' and I want to extract just the \'1234\' part.
\'gfgfdAAA1234ZZZuijjk\'
\'1234\'
I only know what will be the few characte
>>> s = 'gfgfdAAA1234ZZZuijjk' >>> start = s.find('AAA') + 3 >>> end = s.find('ZZZ', start) >>> s[start:end] '1234'
Then you can use regexps with the re module as well, if you want, but that's not necessary in your case.