In [1]:
import visa
rm = visa.ResourceManager()

In [2]:
rm.list_resources()


Out[2]:
('ASRL5::INSTR', 'ASRL10::INSTR', 'GPIB0::2::INSTR')

Open Keithley 2000


In [3]:
k20 = rm.open_resource('GPIB0::2::INSTR')

Reset the Keithley 2000


In [4]:
k20.write('*RST')


Out[4]:
(6, <StatusCode.success: 0>)

Get Keithley 2000 identification


In [5]:
k20.query('*IDN?')


Out[5]:
'KEITHLEY INSTRUMENTS INC.,MODEL 2000,1012650,A19  /A02  \n'

In [6]:
k20.write(":SENSe:FUNCtion 'Voltage:DC'")
k20.query('READ?')


Out[6]:
'+1.55088268E-04\n'

In [7]:
k20.query_ascii_values('READ?')


Out[7]:
[0.000153814355]

In [8]:
k20.close()