Python Forum

Full Version: How to use a variable in linux command in python code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a python code. In my code I run this commands via os.system. How can i give sAMAccountName as a parameter?

I have a variable which is name. It can change in every search. I want to write name instead of the sAMAccount, and command will run according to it.

ldapsearch -x -H "ldap://192.168.1.240:368" -D "[email protected]" -w "foo" -b "dc=my,dc=server" '(sAMAccountName=user1)'
Do you un
Do you understand f-strings, or at least string concatenation?