我正在尝试使用以下名称重命名文本文件:
MLPClassifier(activation='relu', alpha=0.0001, batch_size='auto', beta_1=0.9,
beta_2=0.999, early_stopping=True, epsilon=1e-08,
hidden_layer_sizes=(181, 181, 181), learning_rate='constant',
learning_rate_init=0.05, max_iter=100, momentum=0.9,
nesterovs_momentum=True, power_t=0.5, random_state=None,
shuffle=True, solver='adam', tol=0.0001, validation_fraction=0.1,
verbose=False, warm_start=False)
当我复制粘贴上面的名称并尝试重命名文件时,我能够重命名,但是使用Python程序尝试相同的操作会出现错误
FileNotFoundError: [Errno 2] No such file or directory: "MLPClassifier(activation='relu', alpha=0.0001, batch_size='auto', beta_1=0.9,\n beta_2=0.999, early_stopping=True, epsilon=1e-08,\n hidden_layer_sizes=(181, 181, 181), learning_rate='constant',\n learning_rate_init=0.05, max_iter=100, momentum=0.9,\n nesterovs_momentum=True, power_t=0.5, random_state=None,\n shuffle=True, solver='adam', tol=0.0001, validation_fraction=0.1,\n verbose=False, warm_start=False).txt"
这是我的代码:
modelDetailsAndResults = modelName+'.txt'
output_file = open(modelDetailsAndResults,"w", encoding="utf8")
output_file.write("model details:")
output_file.write(modelName)
output_file.close()
答案 0 :(得分:1)
这是因为您不能重命名某些字符以上的文件。我猜大概在251附近,但不确定。您使用的字符数很多