gpt4 book ai didi

python - 在 Spyder 的 IPython 控制台中使用 awk

转载 作者:行者123 更新时间:2023-12-01 09:17:42 24 4
gpt4 key购买 nike

我想从我的文件中删除额外的标题,并使用以下内容:

awk '{ print $1}' test.txt > output.txt

然后我收到接下来的几行响应:

    File "<ipython-input-23-aa9db656210f>", line 1
awk '{ print $1}' test.txt > output.txt
^
SyntaxError: invalid syntax

不太确定我哪里出了问题,awk 命令是否缺少某些内容?我需要安装一些额外的软件包吗?我正在使用 Spyder IDE...

最佳答案

来自Carlos Cordoba's comment :

You can run bash commands in IPython by prefixing them with !. In this case this corresponds to !awk '{ print $1}' test.txt > output.txt

关于python - 在 Spyder 的 IPython 控制台中使用 awk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51089235/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com