我计算平均时间,我想显示没有微秒的结果平均值.
avg = sum(datetimes, datetime.timedelta(0)) / len(datetimes)
Run Code Online (Sandbox Code Playgroud) 我在这个网站上的第一个问题,我来得很快.我是开发人员,我主要使用Python和Perl.我很有激情,我非常喜欢这个发展.
我的第一个问题是关于Perl,Moo和Type :: Tiny.Type :: Tiny当然是与Moo一起使用的一个很棒的模块,但我会在另一个问题上回到这个主题.
我发现了Types :: Path :: Tiny Moose和Moo的模块强制,所以我尝试在我的类中创建一个属性目录,就像文档中描述的一样,因为我的项目在Moose中工作,但是因为我搬进了Moo ,它不再有效:
package MahewinBlogEngine::Common;
use strict;
use warnings;
use feature "state";
use Moo;
use Types::Path::Tiny qw/Path AbsPath/;
use CHI;
use MahewinBlogEngine::Renderer;
use Type::Params qw( compile );
use Types::Standard qw( slurpy Object Str HashRef ArrayRef );
=attr directory
rw, required, Str. The directory contain articles.
=cut
has 'directory' => (
is => 'rw',
isa => AbsPath,
required => 1,
coerce => 1,
);
Run Code Online (Sandbox Code Playgroud)
在我的测试目录中:
my $articles = MahewinBlogEngine->articles( …Run Code Online (Sandbox Code Playgroud) 我曾经做过研究ag.vim.目前,它在第一次出现的缓冲区中打开文件,默认行为为vimgrep.我想知道是否有选项可以不这样做,并且能够在搜索后直接导航到快速列表.
谢谢