无法猜测程序中的无效语法

时间:2019-04-09 13:39:31

标签: python python-3.x

必须在我使用的位置打印星号,但即将出现无效的语法错误

# printing star in a heart shape format
for row in range(0,6):
    for colu in range(0,7):
        if row==0 and colu%3!==0:
            print('*',end=='')
        elif row==1 and colu%3==0:
            print('*',end=='')
        elif row-colu==2:
            print('*',end=='')
        elif row+colu==8:
            print('*',end=='')
        else:
            print(' ',end=='')

3 个答案:

答案 0 :(得分:0)

将row == 0和colu%3!== 0替换为

if row==0 and colu%3!=0

答案 1 :(得分:0)

正如其他人所说,您需要将!==替换为!=。但是,您还需要将end==更改为end=

答案 2 :(得分:0)

此:

GET

应该是这样的:

CookieManager cookieManager = new CookieManager();
CookieHandler.setDefault(cookieManager);

URL url = new URL("url");

URLConnection connection = url.openConnection();
connection.getContent();

List<HttpCookie> cookies = cookieManager.getCookieStore().getCookies();
for (HttpCookie cookie : cookies) {
    System.out.println(cookie.getDomain());
    System.out.println(cookie);
}

所有if row==0 and colu%3!==0: 的形式应为if row == 0 and colu % 3 != 0:

所以在一起:

end==