DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

VBS to Python Syntax

Solved!
Go to solution

Hello,

 

The following command works fine in a VBS script but I'm having trouble converting it to Python script with Diadem.

First is in VBS, second is in Python. The script documentation doesn't appear to have any python specific examples yet. 

 

k = Find("Ch(""[2]/[7]"")>1",1)
k = dd.Find("Ch(""[1]/[29]"")>1",1)

 

0 Kudos
Message 1 of 3
(2,319 Views)
Solution
Accepted by topic author DTS_PBO

Hi,

 

The problem is that double- double quote ("").

In VBS, that is the escape to add a " within a string. In Python it is \" instead.

 

So you can write:

 

k = dd.find("Ch(\"[1]/[2]\")>10",1)

 

 

Or, even better, since Python supports both ' and " as beginning of a string:

 

k = dd.find('Ch("[1]/[2]")>10',1)

 

In this way, you don't need any escape!

 

Message 2 of 3
(2,289 Views)

That's got it! Thanks for the help and detailed explanation. 

0 Kudos
Message 3 of 3
(2,281 Views)