相关文章推荐
打酱油的啄木鸟  ·  Azure DevOps Server ...·  1 年前    · 
失眠的烤地瓜  ·  Python 操纵 word ...·  1 年前    · 

转自:​ ​https://www.cnblogs.com/clarke157/p/6609761.html​

Java提供了System类的静态方法getenv()和getProperty()用于返回系统相关的变量与属性,getenv方法返回的变量大多于系统相关,getProperty方法返回的变量大多与java程序有关。

代码说明:

System.getenv() 方法是获取指定的环境变量的值。

System.getenv(String str) 接收参数为任意字符串,当存在指定环境变量时即返回环境变量的值,否则返回null。

System.getProperty() 是获取系统的相关属性,包括文件编码、操作系统名称、区域、用户名等,此属性一般由jvm自动获取,不能设置。

System.getProperty(String str) 接收参数为任意字符串,当存在指定属性时即返回属性的值,否则返回null。

publicclass testenv {
publicstaticvoid main(String[] args) {
Map<String, String> map = System.getenv();
for(Iterator<String> it = map.keySet().iterator();it.hasNext();){
String key = it.next();
System.out.println(key + "=" + map.get(key));
}
}
}

总结:

它们返回的是都是map类型的键对值。

python 异步线程池 python异步调用

最近遇到个问题, NLP相关的代码,尤其是DL相关的代码,处理千万级数据显得会慢一些,有可能要好几个小时,那前端的等待是不可行的,这个时候就需要采用python的异步函数了。同步代码import time def hello(): time.sleep(1) def run(): for i in range(5): hello()