我试图在virtualenvwrapper环境中安装gdal(pip install gdal),但是我收到了这个错误:
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for gdal
Failed to build gdal
Run Code Online (Sandbox Code Playgroud)
我也试过"pip install --no-install GDAL",但没有选择--no-install
我该怎么办 !?
我有一个文本文件,其中包含大量文件路径file.txt:
C:\data\AS\WO\AS_WOP_1PPPPPP20070506.bin
C:\data\AS\WO\AS_WOP_1PPPPPP20070606.bin
C:\data\AS\WO\AS_WOP_1PPPPPP20070708.bin
C:\data\AS\WO\AS_WOP_1PPPPPP20070808.bin
...
Run Code Online (Sandbox Code Playgroud)
我用Regex从路径中提取日期的方法:
import re
textfile = open('file.txt', 'r')
filetext = textfile.read()
textfile.close()
data = []
for line in filetext:
matches = re.search("AS_[A-Z]{3}_(.{7})([0-9]{4})([0-9]{2})([0-9]{2})", line)
data.append(line)
Run Code Online (Sandbox Code Playgroud)
它没有给我想要的东西.
我的输出应该是这样的:
year month
2007 05
2007 06
2007 07
2007 08
Run Code Online (Sandbox Code Playgroud)
然后将其保存为列表列表:
[['2007', '5'], ['2007', '6'], ['2007', '7'], ['2007', '8']]
Run Code Online (Sandbox Code Playgroud)
或将其保存为熊猫系列.
有什么方法regex可以得到我想要的东西!?
我试图在 JUnit 测试中避免重复代码,但我有点卡住了。
这是我的第一个测试,对于第二个测试,它具有完全相同的方法但不同的服务(不同的输入)。而不是TestCaseResourceTest1我有TestCaseResourceTest2。现在测试两者的正确方法是什么?我想为测试编号 2 设置一个单独的文件,我应该如何避免重复代码?(例如,使用 beforeFileTest() 方法)
public class TestCaseResourceTest1 {
@Mock
private TestService testService;
@Mock
private AreaService areaService;
private TestCaseService1 testCaseService1; // is changed in test2
@Before
public void before() throws Exception{
testCaseService1 = mock(TestCaseService1.class); // is changed in test2
MockitoAnnotations.initMocks(this);
beforeFileTest();
}
private void beforeFileTest() throws Exception{
doReturn(true).when(areaService).chechExists(any(String.class), eq(false));
}
@Test
public void verifyFileExists() throws Exception{
verifyOtherArea(testCaseService1); // is changed in test2
doReturn(false).when(areaService).chechExists(any(String.class), eq(false));
}
}
Run Code Online (Sandbox Code Playgroud)
只是带有注释的行is changed in test2是差异。
Tnx
有什么办法可以在package.json中的publishConfig中定义两个注册表?
用例是根据目的在 2 个不同的位置发布工件,当它是 SNAPSHOT 时,它将使用快照路径,而为了发布目的,它使用另一个。
就像是:
"publishConfig": {
"snapshot-registry": "http://artifactory.test/artifactory/api/npm-snapshots"
"release-registry": "http://artifactory.test/artifactory/api/npm-releases"
},
Run Code Online (Sandbox Code Playgroud) 我尝试使用以下菜单资源更改应用语言:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.eng:
String languageToLoad = "en";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale; // deprecated!!
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics()); // deprecated!!
this.setContentView(R.layout.activity_main);
break;
case R.id.de:
languageToLoad = "de";
locale = new Locale(languageToLoad);
Locale.setDefault(locale);
config = new Configuration();
config.locale = locale; // deprecated!!
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics()); // deprecated!!
this.setContentView(R.layout.activity_main);
break;
}
return super.onOptionsItemSelected(item);
}
Run Code Online (Sandbox Code Playgroud)
同时compileSdkVersion 25,minSdkVersion 16,targetSdkVersion 25
我知道更换使用createConfigurationContext,但我不知道如何使用它.我尝试过这个,但它不起作用:
switch …Run Code Online (Sandbox Code Playgroud) 如何将两个数组合并为唯一key:
keyList = ["a", "b", "c", "d"]
keyValueList = [
["a", [1, 2, 3]],
["a", [4, 5, 6]],
["b", [5, "a", 3]],
["b", ["test", 4, 3]],
["c", [1, "number", 110]]
]
Run Code Online (Sandbox Code Playgroud)
得到以下?
[
["a", [[1, 2, 3], [4, 5, 6]]],
["b", [[5, "a", 3], ["test", 4, 3]]],
["c", [[1, "number", 110]]]
]
Run Code Online (Sandbox Code Playgroud) java ×2
python ×2
android ×1
arrays ×1
artifactory ×1
deprecated ×1
gdal ×1
javascript ×1
junit ×1
locale ×1
localization ×1
mockito ×1
npm ×1
package.json ×1
pandas ×1
pip ×1
regex ×1
ruby ×1
virtualenv ×1