我想在按钮之间给出间距是否有办法使用引导程序给出间距,以便它们对于不同的屏幕分辨率是一致的.
我尝试过使用margin-left
但这是正确的方法吗?
这是演示
HTML:
<div class="btn-toolbar text-center well">
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ADD PACKET
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> EDIT CUSTOMER
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
<span class="glyphicon glyphicon-time" aria-hidden="true"></span> HISTORY
</button>
<button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> DELETE CUSTOMER
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.margin-left{
margin-left: 80px !important; …
Run Code Online (Sandbox Code Playgroud) 我想生成一个基于int
零的字符串.而且长度应始终5
不超过那个长度.
For example:
Consider a Integer: 1
Formatted String : 00001
Consider a Integer: 12
Formatted String : 00012
Consider a Integer: 110
Formatted String : 00110
Consider a Integer: 1111
Formatted String : 01111
Consider a Integer: 11111
Formatted String : 11111
Run Code Online (Sandbox Code Playgroud) 我正在尝试对包含数字的字符串列表进行排序
a = ["1099.0","9049.0"]
a.sort()
a
['1099.0', '9049.0']
b = ["949.0","1099.0"]
b.sort()
b
['1099.0', '949.0']
a
['1099.0', '9049.0']
Run Code Online (Sandbox Code Playgroud)
但是列表b
是排序而不是列表a
我正在尝试保存我已经尝试过的scrapy crawl命令的输出
scrapy crawl someSpider -o some.json -t json >> some.text
但它没有用...有些机构告诉我如何将输出保存到文本文件....我的意思是日志和信息打印scrapy ...
我想格式化这样的日期:
May 02 2013
但目前,我的格式如下:
May 2 2013
如何将这种类型的日期归零,以便日期中的日期02
不仅仅是2
?
这是我正在使用的代码:
var m_names = new Array("January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October", "November", "December");
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
var curr_year = d.getFullYear();
alert( m_names[curr_month] + " " +curr_date + " " + curr_year);
Run Code Online (Sandbox Code Playgroud)
我正在尝试用scrapy 刮一个网站,但是我在从这个网站上抓取所有产品时遇到问题,因为它使用无休止的滚动...
我只能抓下52件商品的数据,但他们是3824件商品.
hxs.select("//span[@class='itm-Catbrand strong']").extract()
hxs.select("//span[@class='itm-price ']").extract()
hxs.select("//span[@class='itm-title']").extract()
Run Code Online (Sandbox Code Playgroud)
如果我使用hxs.select("//div[@id='content']/div/div/div").extract()
然后它提取整个项目列表但它不会进一步过滤....我如何刮掉所有项目?
我试过这个但结果相同.我哪里错了?
def parse(self, response):
filename = response.url.split("/")[-2]
open(filename, 'wb').write(response.body
for n in [2,3,4,5,6]:
req = Request(url="http://www.jabong.com/men/shoes/?page=" + n,
headers = {"Referer": "http://www.jabong.com/men/shoes/",
"X-Requested-With": response.header['X-Requested-With']})
return req
Run Code Online (Sandbox Code Playgroud) 我想将多个值传递给序列化程序。
#models.py
class Attendance(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
attendance_of = GenericForeignKey()
day = models.DateField()
is_present = models.BooleanField(default=True)
remark = models.CharField(max_length=100, blank=True, default='')
#serializers.py
class AttendanceSerializer(serializers.ModelSerializer):
class Meta:
model = Attendance
Run Code Online (Sandbox Code Playgroud)
现在,如果我传递一个值,那么它可以毫无问题地工作。
如果我尝试通过终端传递值列表,它也可以工作,但如果我使用 POST 将值发送到序列化程序,则会出现错误。
#payload sample
request.data = [
{u'remark': u'OK', u'is_present': u'true', u'day': u'2016-01-31', u'object_id': 1, u'content_type': 19, "id": 1,},
{u'remark': u'OK', u'is_present': u'true', u'day': u'2016-02-31', u'object_id': 1, u'content_type': 19, "id": 2,}
]
Run Code Online (Sandbox Code Playgroud)
追溯:
Traceback (most recent call last):
File "/home/prime/.virtualenvs/omapi/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 174, in get_response
response = …
Run Code Online (Sandbox Code Playgroud) 我试图为我的10位数的Django模型生成独特的HASH值我已经尝试过这些方法,但是我收到了这个错误
return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: column hash_3 is not unique
Run Code Online (Sandbox Code Playgroud)
在这里我尝试过:
import os
import time
import hashlib
from os import path
from binascii import hexlify
from django.db import models
from django.contrib import admin
from django.core.files.storage import FileSystemStorage
#------------------------------------------------------------------------------
def _createHash():
"""This function generate 10 character long hash"""
hash = hashlib.sha1()
hash.update(str(time.time()))
return hash.hexdigest()[:-10]
class tags(models.Model):
""" This is the tag model """
seo_url1 = models.URLField()
seo_url2 = models.URLField()
seo_url3 = models.URLField()
tagDescription = models.TextField() # Tag Description
tag = …
Run Code Online (Sandbox Code Playgroud) 我写了一只蜘蛛,但每当我运行这个蜘蛛时我都会收到这个错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/base.py", line 824, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/task.py", line 607, in _tick
taskObj._oneWorkUnit()
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/task.py", line 484, in _oneWorkUnit
result = next(self._iterator)
File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/defer.py", line 57, in <genexpr>
work = (callable(elem, *args, **named) for elem in iterable)
--- <exception caught here> ---
File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/defer.py", line 96, in iter_errback
yield it.next()
File "/usr/local/lib/python2.7/dist-packages/scrapy/contrib/spidermiddleware/offsite.py", line 28, in process_spider_output
for x in result:
File "/usr/local/lib/python2.7/dist-packages/scrapy/contrib/spidermiddleware/referer.py", line 22, in <genexpr>
return (_set_referer(r) for r in result …
Run Code Online (Sandbox Code Playgroud)