Python 3.x 在bash中以几行打印python文件的结果
我有一个python文件,它有一个for循环 假设文件python.py: 我将此代码作为.coffee文件中的bash命令运行Python 3.x 在bash中以几行打印python文件的结果,python-3.x,bash,coffeescript,Python 3.x,Bash,Coffeescript,我有一个python文件,它有一个for循环 假设文件python.py: 我将此代码作为.coffee文件中的bash命令运行 我确实在python中的print命令中添加了“\n”。python代码中有一个问题,没有冒号:在for循环之后。此外,不需要对每一行写入\n,python将自动将每一个字母移动到新行: #! /usr/bin/python for i in "Hello": print(i) 将其放入python脚本中,然后再次编译coffee脚本,其输出如下:
我确实在python中的print命令中添加了“\n”。python代码中有一个问题,没有冒号:在for循环之后。此外,不需要对每一行写入\n,python将自动将每一个字母移动到新行:
#! /usr/bin/python
for i in "Hello":
print(i)
将其放入python脚本中,然后再次编译coffee脚本,其输出如下:
command: "export LANG=en_CA.UTF-8; python3 folder/python.py"
refreshFrequency: 1000*60
style: """
top: 245px
right: 0px
width: 240px
height: 600px
margin-left: -(@width / 2)
overflow: hidden
.content
background: rgba(#fff, 0.5)
color: #152033
margin-left: 3px
font-size: 18px
font-family: Ubuntu
text-align: left
.title
background: rgba(#fff, 0.5)
color: #152033
font-size: 40px
font-family: Ubuntu
text-align: center
bg-blur = 10px
.bg-slice
position: absolute
top: -(bg-blur)
left: -(bg-blur)
width: 100% + 2*bg-blur
height: 100% + 2*bg-blur
-webkit-filter: blur(bg-blur)
"""
render: (output) -> """
<canvas class='bg-slice'></canvas>
<div class='title'>Inbox:</div>
<div class='content'>#{output}</div>
"""
H
e
l
l
o
#! /usr/bin/python
for i in "Hello":
print(i)
H
e
l
l
o