我知道如何在我的/ etc/profile和我的环境变量中设置它.
但是如果我想在脚本中设置它呢?是导入os,sys?我该怎么做?
而不是去views.py,我希望它转到模板robots.txt.
data = {
'ids': [12, 3, 4, 5, 6 , ...]
}
urllib2.urlopen("http://abc.com/api/posts/create",urllib.urlencode(data))
Run Code Online (Sandbox Code Playgroud)
我想发送一个POST请求,但其中一个字段应该是一个数字列表.我怎样才能做到这一点 ?(JSON?)
如果我在头部放置一个div并显示:none,而不是使用JavaScript来显示它,这会有效吗?
编辑:
我在AJAX中加载了东西.当我的AJAX更改网站的"主要"部分时,我也想更改元标记.
我希望得到1到 24,1是太平洋时间凌晨1点.
我怎样才能在Node.JS中获得该号码?
我想知道太平洋时间现在几点了.
我编辑什么文件,以及如何编辑?我创建了一个虚拟环境.
我在EC2实例上.所以没有GUI.
$pip install selenium
$sudo apt-get install firefox xvfb
Run Code Online (Sandbox Code Playgroud)
然后我这样做:
$Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &
$DISPLAY=:1 java -jar selenium-server-standalone-2.0b3.jar
05:08:31.227 INFO - Java: Sun Microsystems Inc. 19.0-b09
05:08:31.229 INFO - OS: Linux 2.6.32-305-ec2 i386
05:08:31.233 INFO - v2.0 [b3], with Core v2.0 [b3]
05:08:32.121 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
05:08:32.122 INFO - Version Jetty/5.1.x
05:08:32.123 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
05:08:32.124 INFO - Started HttpContext[/selenium-server,/selenium-server]
05:08:32.124 INFO - Started HttpContext[/,/]
05:08:32.291 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1186fab …
Run Code Online (Sandbox Code Playgroud) d3 = dict(d1, **d2)
Run Code Online (Sandbox Code Playgroud)
我明白这会合并字典.但是,它有独特之处吗?如果d1与d2具有相同的键但值不同,该怎么办?我希望合并d1和d2,但如果有重复键,则d1具有优先权.
var Gallery = Backbone.Controller.extend({
_index: null,
_photos: null,
_album :null,
_subalbums:null,
_subphotos:null,
_data:null,
_photosview:null,
_currentsub:null,
routes: {
"": "index",
"subalbum/:id": "subindex",
"subalbum/:id/" : "directphoto",
"subalbum/:id/:num" : "hashphoto"
},
initialize: function(options) {
var ws = this;
if (this._index === null){
$.ajax({
url: 'data/album1.json',
dataType: 'json',
data: {},
success: function(data) {
ws._data = data;
ws._photos =
new PhotoCollection(data);
ws._index =
new IndexView({model: ws._photos});
Backbone.history.loadUrl();
}
});
return this;
}
return this;
},
//Handle rendering the initial view for the
//application
index: function() …
Run Code Online (Sandbox Code Playgroud) python ×7
javascript ×3
linux ×3
unix ×3
datetime ×2
backbone.js ×1
date ×1
dictionary ×1
django ×1
http ×1
jquery ×1
json ×1
meta-tags ×1
node.js ×1
oop ×1
post ×1
selenium ×1
templates ×1
url ×1
virtualenv ×1