如何在PyCharm IDE中折叠几行选定的代码?
How to fold few selected lines of code in PyCharm IDE?
如何在 PyCharm Ide.
中折叠几行选定的代码
例如,我想折叠下图中显示的选定代码行:
# Importing the dataset
dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.iloc[:, 13].values
# Encoding categorical data
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X_1 = LabelEncoder()
X[:, 1] = labelencoder_X_1.fit_transform(X[:, 1])
labelencoder_X_2 = LabelEncoder()
X[:, 2] = labelencoder_X_2.fit_transform(X[:, 2])
onehotencoder = OneHotEncoder(categorical_features = [1])
X = onehotencoder.fit_transform(X).toarray()
X = X[:, 1:]
# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)
我找到了解决方法!!
步骤:
- Select 您要折叠的代码行,然后按
CTRL + .
(Ctrl + 点)。
或
- 右键单击并导航到折叠 -> 单击 'Fold Selection/Remove Region' 选项。
截图:
结果:
如何在 PyCharm Ide.
中折叠几行选定的代码例如,我想折叠下图中显示的选定代码行:
# Importing the dataset
dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.iloc[:, 13].values
# Encoding categorical data
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X_1 = LabelEncoder()
X[:, 1] = labelencoder_X_1.fit_transform(X[:, 1])
labelencoder_X_2 = LabelEncoder()
X[:, 2] = labelencoder_X_2.fit_transform(X[:, 2])
onehotencoder = OneHotEncoder(categorical_features = [1])
X = onehotencoder.fit_transform(X).toarray()
X = X[:, 1:]
# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)
我找到了解决方法!!
步骤:
- Select 您要折叠的代码行,然后按
CTRL + .
(Ctrl + 点)。
或
- 右键单击并导航到折叠 -> 单击 'Fold Selection/Remove Region' 选项。
截图:
结果: