Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在一行中打印Python对象的名称?_Python - Fatal编程技术网

如何在一行中打印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','') )

你的显示器真的很宽吗?这取决于你使用的终端模拟器和它的换行选项。