小编Aik*_*ura的帖子

AWK 不打印输出文件分隔符 OFS

输入

15.01.2018;Payment sent;;500.00;;
20.12.2017;Payment received;10.40;;;
Run Code Online (Sandbox Code Playgroud)

预期输出

15.01.2018;Payment sent;-500.00
20.12.2017;Payment received;10.40
Run Code Online (Sandbox Code Playgroud)

电流输出

15.01.2018Payment sent-500.00
20.12.2017Payment received10.40
Run Code Online (Sandbox Code Playgroud)

有人在我的命令中看到了问题吗?

awk 'BEGIN{OFS=";";FS=";"} {print match($4, /[^ ]/) ? $1$2$3"-"$4 : $1$2$3}' < in.csv > out.csv
Run Code Online (Sandbox Code Playgroud)

谢谢

bash awk

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

如何修改hugo的主页?

如何将 /posts 作为主页?

我应该重定向、更改hugo 1配置中的baseURL还是在主题2配置中进行更改?

脚注

1 https://gohugo.io/getting-started/configuration/

2 https://github.com/luizdepra/hugo-coder/wiki/Configurations

hugo

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

AWS-CDK 类型“(cls: Runtime) -&gt; Runtime”无法分配给类型“Runtime”

我收到指向runtime=_lambda..变量的 Flycheck 错误:

\n

Argument of type "(cls: Runtime) -> Runtime" cannot be assigned to parameter "runtime" of type "Runtime" in function "__init__" \xc2\xa0\xc2\xa0Type "(cls: Runtime) -> Runtime" cannot be assigned to type "Runtime"

\n
# create lambda function\n# executed as root\nfunction = _lambda.Function(self,\n                            "lambda_function",\n                            runtime=_lambda.Runtime.PYTHON_3_7,\n                            handler="lambda_handler.main",\n                            code=_lambda.Code.from_asset("./lambda"),\n                            environment={\n                                \'EC2_INSTANCE_ID\':\n                                instance.instance_id,\n                                \'S3_OUTPUT\':\n                                output_s3.s3_url_for_object(),\n                                \'S3_INPUT\':\n                                input_s3.s3_url_for_object()\n                            })\n\n
Run Code Online (Sandbox Code Playgroud)\n

这是一个相当表面的 IDE 问题,代码本身可以工作

\n

python aws-cdk

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

atof 返回无法将字符串转换为浮点数:'2, 5'

我试图理解atof方法,但是,下面的块失败,主题标题中出现错误:

 import locale
 s='2,5'
 x=locale.atof(s)
Run Code Online (Sandbox Code Playgroud)

我能做些什么?

python

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

如何减少列表中的列表

我的直觉告诉我reduce(from functools import reduce)会提供我正在寻找的东西,但我无法在这里使用它。

def test_reduce_lists_by_summing_them():
    """
    Sum each item from the first list with the same positional item from the subsequent list. 
    The result is the next first list and appended to the returned result list.
    """
    input_ = [[1, 0, 0], [0, 1, 0], [0, 0, 2], [3, 0, 0]]
    expected_output = [[1, 1, 0], [1, 1, 2], [4, 1, 2]]

    def f(x, y):
        """Return the sum of two positional items"""
        return x + y

    output …
Run Code Online (Sandbox Code Playgroud)

python functools

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

如何安装cpanm依赖项?

我该怎么做才能使这个工作?

我不是perl专家,因此除了工具安装手册指示我运行此行之外,我不能再提供任何细节了:

cd ~
cpanm --sudo --installdeps .
Run Code Online (Sandbox Code Playgroud)

返回

--> Working on .
Configuring /home/user ... N/A
! Configuring . failed. See /home/user/.cpanm/work/1532680018.20391/build.log for details.
Run Code Online (Sandbox Code Playgroud)

日志

cat /home/user/.cpanm/work/1532680018.20391/build.log


cpanm (App::cpanminus) 1.7044 on perl 5.026002 built for x86_64-linux-thread-multi
Work directory is /home/user/.cpanm/work/1532680018.20391
You have make /usr/bin/make
You have LWP 6.33
You have /usr/bin/tar: tar (GNU tar) 1.30

You have /usr/bin/unzip
--> Working on .
Entering /home/user
Configuring /home/user
-> N/A
! Configuring . failed. See /home/user/.cpanm/work/1532680018.20391/build.log for details.
Run Code Online (Sandbox Code Playgroud)

perl cpan

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

标签 统计

python ×3

awk ×1

aws-cdk ×1

bash ×1

cpan ×1

functools ×1

hugo ×1

perl ×1