Respexted sir ,
i am new to power automate I have problem with getting wrong output from python in desktop automate.
k="""%NewVar2%"""
o="""%List3%"""
len([each for each in o if each.lower() in k.lower()])>=2
case : 1
NewVar2 is variable as= Ram shyam sam
List3=["Ram","shyam"]
##################### Got Output in power automate as True
##################### Got Output in Python True
case : 2
NewVar2 is variable as= Ram shyam sam
List3=["Rama","ashyam"]
##################### Got Output in power automate as True
##################### Got Output in Python as False
Why ? my output is differ from original in python ide,
I need that true or false produced by python
Can I get that output somehow?
So tried thing like
k="""%NewVar2%"""
o="""%List3%"""
kk=len([each for each in o if each.lower() in k.lower()])>=2
print(kk)
but this is also not working?
thanks
your faithfully
saurabh
Solved! Go to Solution.
Try This,
k="""%FileContents%"""
o=['ram','shyam']
kk=len([each for each in o if each.lower() in k.lower()])>=2
print(kk)
Hi Saurabh,
You are getting this error because Python script can't be understand by Power Automate List or vice-versa.
Hence, you need to try following steps
k="""%NewVar2%"""
o=['ramm','shyam']
kk=[]
kkj=len([each for each in o if each.lower() in k.lower()])>=2
kk.append(kkj)
kk.append("true")
print(kk)
k="""%NewVar2%"""
str="""%List3%"""
kk=str.lstrip("[").rstrip("]")
o=kk.split(',')
kk=[]
kkj=len([each for each in o if each.lower() in k.lower()])>=2
kk.append(kkj)
kk.append("true")
print(kk)
nice solution sir,this best thing when python returns array
Try This,
k="""%FileContents%"""
o=['ram','shyam']
kk=len([each for each in o if each.lower() in k.lower()])>=2
print(kk)
Hi Saurabh,
You are getting this error because Python script can't be understand by Power Automate List or vice-versa.
Hence, you need to try following steps
k="""%NewVar2%"""
o=['ramm','shyam']
kk=[]
kkj=len([each for each in o if each.lower() in k.lower()])>=2
kk.append(kkj)
kk.append("true")
print(kk)
thanks this is also nice solution
k="""%NewVar2%"""
str="""%List3%"""
kk=str.lstrip("[").rstrip("]")
o=kk.split(',')
kk=[]
kkj=len([each for each in o if each.lower() in k.lower()])>=2
kk.append(kkj)
kk.append("true")
print(kk)
Yes this is nice solution.....also
nice solution sir,this best thing when python returns array