#!/usr/bin/python
import sys,re
import subprocess
def funa():
a = str(raw_input('Enter your choice [PRIMARY|SECONDARY]: ')).upper().strip()
p = re.compile(r'.*'+a+'.*')
result = p.findall(a)
str1 = ''.join(result)
print str1
funa()
I have above code in test.py file and When I run this code and give my choice as SECONDARY, I am getting the output SECONDARY as string:
[oracle@localhost oracle]$ ./test.py
Enter your choice [PRIMARY|SECONDARY]: SECONDARY
SECONDARY
I want to add prefix as '^' and suffix as '$' to add in my output. Which should be a string only. Means I want to get the output as :
^SECONDARY$
Please let me know how can I achieve this.
+on strings earlier in your function. What is it you're having trouble with?