web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Running python in powe...
Power Automate
Answered

Running python in power automate desktop error

(0) ShareShare
ReportReport
Posted on by 94

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

  • Verified answer
    iamspyder Profile Picture
    9 on at

    Try This,

     

    k="""%FileContents%"""
    o=['ram','shyam']

    kk=len([each for each  in o  if each.lower() in k.lower()])>=2
    print(kk)

  • Verified answer
    Dipak Badgujar Profile Picture
    34 on at

    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)

    1.png2.png3.png4.png5.0.png6.png

  • Verified answer
    saurabh_talele Profile Picture
    94 on at

    thanks this is also nice solution

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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)

  • saurabh_talele Profile Picture
    94 on at

    Yes this is nice solution.....also

  • Verified answer
    saurabh_talele Profile Picture
    94 on at

    nice solution sir,this best thing when python returns array

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 259 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 227 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 134 Super User 2026 Season 2

Last 30 days Overall leaderboard