我是新手在终端中运行python脚本.我运行了脚本./filename.py并确保它是可执行的chmod + x filename.我还把#!/ usr/bin/env python放在程序的顶部.我没有错误,但我的终端中没有显示任何打印语句.附上是我的代码.有任何想法吗?
#!/usr/bin/env python
import ctypes
import os
def is_hidden(filepath):
name = os.path.basename(os.path.abspath(filepath))
return ('.' + name) or (has_hidden_attribute(filepath))
def has_hidden_attribute(filepath):
try:
attrs = ctypes.windll.kernel32.GetFileAttributesW(unicode(filepath))
assert attrs != -1
result = bool(attrs & 2)
except (AttributeError, AssertionError):
result = False
return result
def main():
print ('whatup')
print(is_hidden('~/.jupyter'))
print('hey')
Run Code Online (Sandbox Code Playgroud)
然后从终端
$ ./makepass_jup.py
$
Run Code Online (Sandbox Code Playgroud)