some code snippet

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里面操作的代码

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 各种纯css图标 CSS3可以实现很多漂亮的图形,我收集了32种图形,在下面列出。直接用CSS3画出这些图形,要比...
    剑残阅读 9,700评论 0 8
  • 学习CSS的最佳网站没有之一 http://www.w3school.com.cn/tags/index.asp ...
    Amyyy_阅读 1,101评论 0 1
  • 问答题47 /72 常见浏览器兼容性问题与解决方案? 参考答案 (1)浏览器兼容问题一:不同浏览器的标签默认的外补...
    _Yfling阅读 13,815评论 1 92
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    wzhiq896阅读 1,806评论 0 2
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,340评论 0 11