I have the following two strings:
request= "1/1/1.3.45.3.6/3/4
reply= "1/2/3"
I want to return a new string, which concatenates the 1.3.45.3.6 of request with 2 of reply to return a list which contains the string.
Output should be a list:
result= ["1.3.45.3.6.2"]
I have the following method, that doesn't work. The inputs to the method are both strings.
def concatentatestring(request, response):
oidStatusValueList = [f"{i.split('/')[2]}.{j.split('/')[2]}" \
for i in request for j in response \
if (i.split('/')[1] == j.split('/')[1]) ]
print(f"{request.split('/')[2]}.{response.split('/')[1]}")gives your desired output, no need to iterate.