简体   繁体   中英

Python how to print tuple without quotes

I know that this is probably an easy question, but how do I remove the quotes produced by this code:

import netsnmp
site = "office"
session = netsnmp.Session( DestHost='10.0.0.250', Version=2, Community='public' )
mod = netsnmp.VarList( netsnmp.Varbind('HOST-RESOURCES-MIB::hrDeviceDescr.1') )
model = session.get(mod)
print model

This produces this output:

('HP Color LaserJet CM4540 MFP',)

How do I get rid of those parentheses and quote marks?

Try:

print model[0]

You're trying to the print the tuple representation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM