我是C#的新手我已经开始学习它以扩展我的编程语言,但我遇到了一个我在C和Java都没有遇到过的小问题.
我试图从键盘获得用户响应,然后将其与可能的情况进行比较,如果这些情况都不匹配,那么我希望用户必须重复该过程,直到他输入正确的值.
String input = Console.ReadLine();
while ((input[0] != 'N') || (input[0] != 'Y'))
input = Console.ReadLine();
if (input[0] == 'N')
{
Console.WriteLine("NO");
Console.ReadKey();
}
else if (input[0] == 'Y')
{
Console.WriteLine("YES");
Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,这不是我尝试过的最有效的方法,我也尝试过做while while循环和许多其他变种.
我遇到的问题是,当while循环未被激活时,一切正常,但是当我添加它时,它总是进入循环,即使输入是N或Y并且即使很明显,它也永远不会离开循环这是错误的.
如果有人可以给我一些关于为什么会发生这种情况的信息,或者有人可能提出更好的方法来做这件事,我将不胜感激.谢谢.
卡里姆
我通常不会合作,VBA我无法弄清楚这一点.我正在尝试确定某个字母是否包含在我的spreadhseet中的字符串中.
Private Sub CommandButton1_Click()
Dim myString As String
RowCount = WorksheetFunction.CountA(Range("A:A"))
MsgBox RowCount
For i = 2 To RowCount
myString = Trim(Cells(i, 1).Value)
If myString.Contains("A") Then
oldStr = Cells(i, 15).Value
newStr = Left(oldStr, oldStr.IndexOf("A"))
End If
Next
End Sub
Run Code Online (Sandbox Code Playgroud)
此代码应该通过一个值列表,如果它遇到字母A以删除它以及它之后的所有内容.我的IF声明,无效的资格赛我遇到了问题.IF无论单元格中的字符串是否包含字母A,我如何才能输出语句?
非常感谢你
我有一个 matplotlib 小部件文本框,如下所示
temp_descr = 'wow'
self.axLabel = plt.axes([0.7, 0.05, 0.21, 0.075])
self.text_boxLabel = TextBox(self.axLabel, 'Label: ', temp_descr)
Run Code Online (Sandbox Code Playgroud)
一旦设置为初始值,我以后如何更改文本?喜欢
temp_descr = 'new wow'
self.text_boxLabel.set_text(temp_descr)
Run Code Online (Sandbox Code Playgroud)
但是,这会出现以下错误
AttributeError:“TextBox”对象没有属性“set_text”
我有两种不同类型的数据(图像体积和坐标),我想对图像体积数据使用卷积神经网络,然后在此之后我想附加一些附加信息(即体积的坐标)。
独立地,这应该为我的函数创建一个非常可靠的预测器。如何使用 Keras 实现这一点。
我在网上找到的唯一答案要么模棱两可,要么正在使用我必须使用的已弃用方法。但我真的很想使用当前的 API 来实现这一点,这样我就可以更轻松地保存模型以供以后使用。
model = Sequential()
model.add(Conv3D(32, kernel_size=(3, 3, 3),
activation='relu',
input_shape=input_shape))
model.add(Conv3D(64, (3, 3, 3), activation='relu'))
model.add(MaxPooling3D(pool_size=(2, 2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
print(model.output_shape)
# The additional data (the coordinates x,y,z)
extra = Sequential()
extra.add(Activation('sigmoid', input_shape=(3,)))
print(extra.output_shape)
merged = Concatenate([model, extra])
# New model should encompass the outputs of the convolutional network and the coordinates that have been merged.
# But how?
new_model = Sequential()
new_model.add(Dense(128, activation='relu'))
new_model.add(Dropout(0.8))
new_model.add(Dense(32, activation='sigmoid'))
new_model.add(Dense(num_classes, activation='softmax'))
new_model.compile(loss=keras.losses.categorical_crossentropy,
optimizer=keras.optimizers.Adadelta(),
metrics=['accuracy'])
Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用VBA,我在使用语法时遇到了一些麻烦.是vba,(列,行)还是(行,列)中单元格的格式?
VBA的确定API类似于Oracle Oracle网站上的API吗?