from sklearn.model_selection import KFoldfrom sklearn.datasets import load_irisfrom sklearn.ensemble import RandomForestClassifierimport numpy as npX,y = load_iris(return_X_y=True)KF = KFold(n_splits=10,shuffle=False,random_state=100)model = RandomForestClassifier()for train_index,test_index in KF.split(X): print("train_index:{},test_index:{}".format(train_index,test_index))