美文网首页
some code snippet

some code snippet

作者: yayaQAQ | 来源:发表于2017-06-14 10:32 被阅读12次
2017-06-14_102746.png

code:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            .div1{
                height: 100px;
                width: 100px;
                border-left: 100px yellow solid;
                border-bottom: 100px black solid;
                border-right: 100px peru solid;
                border-top: 100px goldenrod solid;
            }
        </style>
    </head>
    <body>
        <div class="div1"></div>
    </body>
</html>

原理:
也就是说每一个border是以一个等腰梯形来渲染的,并且上底为内容的宽度,下底设定为内容宽度加上border设定的宽度的两倍,而不是一个长方形,如果我们将width和height全部变为0,那么就可以得到:

2017-06-14_103115.png

将其余的地方变成和背景色一样的话,就可以变成三角形。


for i in PollingItemImages.objects.filter(is_avatar=True):
    i.does_exist=True
    i.save

for i in PollingItemImages.objects.filter(does_exist=True):
    i.does_exist=False
    i.save

len(PollingItemImages.objects.filter(does_exist=True))

for i in PollingItemImages.objects.filter(polling_item_id='c9563da441e2456e88506e54abb91111'):
    if i.image == 'polling/item/img/40ef448d2643498087016a0da8dca4dc.png':
        i.is_avatar=True
    else:
        i.is_avatar=False
    i.save()

    # item  = PollingItemImages.objects.filter(polling_item_id=i.id)

count = 0
for i in PollingItem.objects.filter(is_successful=True):
    item = PollingItemImages.objects.filter(polling_item_id=i.id,is_avatar=True)
    temp = len(item)
    if temp>1:
        print(len(item))
        item.update(does_exist=False)
        temp2=item[temp-1]
        temp2.does_exist=True
        temp2.save()
        count=count+1
        print(temp,count)


count = 0
for i in PollingItem.objects.filter(is_successful=True):
    temp = len(PollingItemImages.objects.filter(polling_item_id=i.id,is_avatar=True,))
    count=count+1
    print(temp,count)

count = 0
for i in PollingItem.objects.filter(is_successful=True):
    item1 = PollingItemImages.objects.filter(polling_item_id=i.id,is_avatar=True,does_exist=True)
    item2 = PollingItemImages.objects.filter(polling_item_id=i.id,is_avatar=True)
    temp = len(item1)

    if temp == 0 :

        count=count+1
        print(temp,count)

一些pythonshell里面操作的代码

相关文章

网友评论

      本文标题:some code snippet

      本文链接:https://www.haomeiwen.com/subject/malsqxtx.html