简体   繁体   English

使用python 3打印获取缩进错误

[英]Getting an indent error with python 3 printing

this is ridiculous that I can't figure out why this isn't working... 这很荒谬,我无法弄清楚为什么这不起作用...

def main():
    """Shows basic usage of the Gmail API.

    Creates a Gmail API service object and outputs a list of label names
    of the user's Gmail account.
    """

    credentials = get_credentials()
    http = credentials.authorize(httplib2.Http())
    service = discovery.build('gmail', 'v1', http=http)

    results = ListThreadsMatchingQuery(service, EMAIL_LOGIN, 'email@gmail.com') ## searching based on email
    print(len(results))

I get the error: 我得到错误:

$ python quickstart1.py 
  File "quickstart1.py", line 155
    print(len(results))
    ^
IndentationError: unexpected indent

What am I doing wrong 我究竟做错了什么

您不能使用4个空格并在Python代码中对它们两个都进行表缩进,下一次将编辑器设置为4个空格缩进

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM