我使用的是Python 2.5,我想要一个像这样的枚举(从1开始而不是0):
[(1, 2000), (2, 2001), (3, 2002), (4, 2003), (5, 2004)]
Run Code Online (Sandbox Code Playgroud)
我知道在Python 2.6中你可以这样做:h = enumerate(range(2000,2005),1)给出上面的结果但是在python2.5中你不能......
使用python2.5:
>>> h = enumerate(range(2000, 2005))
>>> [x for x in h]
[(0, 2000), (1, 2001), (2, 2002), (3, 2003), (4, 2004)]
Run Code Online (Sandbox Code Playgroud)
有谁知道在python 2.5中获得所需结果的方法?
谢谢,
杰夫
我正试图建立Vagrant.我正在关注网站上的指南,目前在指南的配置部分出现问题(http://vagrantup.com/docs/getting-started/provisioning.html)我已经完全按照这个内容进行了操作该网站,但我收到此错误,我在Mac OSX,如果它是任何重要的
evan@superduper ~/vagrant_guide $ vagrant up
There was a problem with the configuration of Vagrant. The error message(s)
are printed below:
chef:
* Run list must not be empty.
Run Code Online (Sandbox Code Playgroud)
这是我的Vagrant文件的代码,如果这也有帮助:
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
# Enable the chef solo provisioner
config.vm.provisioner = :chef_solo
# Grab the cookbooks from the Vagrant files
config.chef.recipe_url = "http://files.vagrantup.com/getting_started/cookbooks.tar.gz"
end
Run Code Online (Sandbox Code Playgroud)
这是什么来自我以及如何解决它?
谢谢
Ĵ