daily pastebin goal
43%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Passing more than two sys.argv in python
  2. from visa import *
  3. import sys
  4. inst = instrument(sys.argv[1])
  5. inst.write("*rst; status:preset; *cls")
  6. inst.write("voltage:UNIT Vrms")
  7. inst.write("apply:SIN %s %s" % sys.argv[2] % sys.argv[3])
  8.    
  9. from visa import *
  10. import sys
  11. inst = instrument("USB0::0x164E::0x13EC::TW00008555")
  12. inst.write("*rst; status:preset; *cls")
  13. inst.write("voltage:UNIT Vrms")
  14. inst.write("apply:SIN 1000, 0.5")
  15.    
  16. inst.write("apply:SIN %s %s" % (sys.argv[2], sys.argv[3]))
  17.    
  18. inst.write("apply:SIN %s, %s" % (sys.argv[2], sys.argv[3]))
  19.    
  20. >>> "test %s %s" % ("a", "b")
  21. 'test a b'
  22.    
  23. >>> "test {0} {1}".format("a", "b")
  24. 'test a b'
  25.    
  26. inst.write("apply:SIN {0}, {1}".format(sys.argv[2], sys.argv[3]))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top