我用下面的命令行调用了我的脚本python3 /home/hironwise/transcribe.py
,然后我得到一个错误unexpected indent File "/home/username/transcribe.py" line 3 def main():
^
我使用了VSL代码编辑器,但我仍然没有得到它的权利
#!/usr/bin/venv python
from pathlib import PureWindowsPath
path=PureWindowsPath('/Users/Ron/AppData/Local/Packages/transcribe.py').is_absolute()
def transcribe_gcs(gcs_uri):
gcs_uri = 'gs://appliedlinguistics66/speech/WhyJonyIveisLeavingApple.mp4'
from google.cloud import speech_v1p1beta1
from google.cloud.speech_v1p1beta1 import enums
from google.cloud.speech_v1p1beta1 import types
client = speech.SpeechClient()
我希望第3行在编辑后正确缩进,但这是我得到的一个错误:
IndentationError: unexpected indent
File "/home/hironwise/transcribe.py", line 3
def main():
^ "
Python语法需要一致的缩进(例如4个空格或1个制表符空格)来正确执行程序
请尝试以下代码
您可能会得到这个错误,因为第3行是由4个不需要的空格组成的
VSCode有很多可用的格式化程序。我使用autopep8
相关问题 更多 >
编程相关推荐