小编Jef*_*ary的帖子

如何枚举从1开始的一系列数字

我使用的是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中获得所需结果的方法?

谢谢,

杰夫

python enums

130
推荐指数
8
解决办法
11万
查看次数

与Vagrant接受这个奇怪的错误,想知道是否有人可以伸出援助之手

我正试图建立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)

这是什么来自我以及如何解决它?

谢谢

Ĵ

ruby ruby-on-rails vagrant

1
推荐指数
1
解决办法
900
查看次数

标签 统计

enums ×1

python ×1

ruby ×1

ruby-on-rails ×1

vagrant ×1