如何在一行中打印Python对象的名称?
我正在尝试打印对象的名称如何在一行中打印Python对象的名称?,python,Python,我正在尝试打印对象的名称 import pandas as pd from sklearn.svm import SVC pd.set_option('display.max_columns', None, 'display.width', 2500) est = SVC(kernel='poly') print(est) 输出为: SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, decision_function_sh
import pandas as pd
from sklearn.svm import SVC
pd.set_option('display.max_columns', None, 'display.width', 2500)
est = SVC(kernel='poly')
print(est)
输出为:
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto_deprecated',
kernel='poly', max_iter=-1, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False)
我想只打印1行(不是4行)的输出。
您知道怎么做吗?您可以使用以下功能:
def print_line(obj)
print( str(obj).replace('\n','') )
你的显示器真的很宽吗?这取决于你使用的终端模拟器和它的换行选项。