小编tki*_*der的帖子

如何在目录名中使用通配符在Perl中打开文件?

我需要打开一个OrthologousGroups.txt从一个目录调用的文件,该目录是根据创建它的日期命名的.例如./Results_2016-2-7

有没有办法在路径名中使用通配符来访问我需要访问的文件?

我尝试了以下内容

open(FILE, "./Results*/OrthologousGroups.txt");
Run Code Online (Sandbox Code Playgroud)

但是我收到了一个错误

关闭文件句柄上的readline()

perl

3
推荐指数
1
解决办法
1568
查看次数

Python3除法:当没有余数时返回int,当有余数时返回浮点数?

在python3中,整数除法的工作方式与python 2.7.3不同.有没有办法确保在除法后没有余数的数字作为int返回,而在除法后有余数的数字作为浮点数返回?

我希望能够检查:

if (instanceof(x/n, int)):
    # do something
Run Code Online (Sandbox Code Playgroud)

python3中发生以下情况:

>>> 4 / 2
2.0
>>> 5 / 2
2.5
Run Code Online (Sandbox Code Playgroud)

有没有办法让分裂这样做?

>>> 4 / 2
2
>>> 5 / 2
2.5
Run Code Online (Sandbox Code Playgroud)

python floating-point python-3.x

1
推荐指数
1
解决办法
417
查看次数

标签 统计

floating-point ×1

perl ×1

python ×1

python-3.x ×1