小编Nic*_*ick的帖子

系统上的Python 2.7,PIP和Virtualenv仍在使用2.6 - 如何将它们切换为使用2.7

我在MacOSx 10.6.8上安装了python 2.7

python -v产生:

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so", 2);
import readline # dynamically loaded from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so
Run Code Online (Sandbox Code Playgroud)

我他们跑:

$ virtualenv venv
Run Code Online (Sandbox Code Playgroud)

然后

$ . venv/bin/activate
Run Code Online (Sandbox Code Playgroud)

并做一个python -v

我得到:

Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/Users/nkhdev/venv/lib/python2.6/lib-dynload/readline.so", 2);
import readline # …
Run Code Online (Sandbox Code Playgroud)

python macos pip virtualenv

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

在Clojure中 - 如何访问结构向量中的键

我有以下结构矢量:

(defstruct #^{:doc "Basic structure for book information."}
  book :title :authors :price)

(def #^{:doc "The top ten Amazon best sellers on 16 Mar 2010."}
  best-sellers
  [(struct book
           "The Big Short"
           ["Michael Lewis"]
           15.09)
   (struct book
           "The Help"
           ["Kathryn Stockett"]
           9.50)
   (struct book
           "Change Your Prain, Change Your Body"
           ["Daniel G. Amen M.D."]
           14.29)
   (struct book
           "Food Rules"
           ["Michael Pollan"]
           5.00)
   (struct book
           "Courage and Consequence"
           ["Karl Rove"]
           16.50)
   (struct book
           "A Patriot's History of the United States"
           ["Larry Schweikart","Michael Allen"] …
Run Code Online (Sandbox Code Playgroud)

clojure

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

将Int映射到列表 - Python

可能重复:
Python:如何将字符串数组转换为数字数组?

我试图将字符串列表映射到Int,当我映射Int函数时,它将2位数字分成2个项目列表:

我有以下代码:

>>> MyList
['10', '5', '6', '7', '8', '9']
>>> MyList = [map(int,x) for x in MyList]
>>> MyList
[[1, 0], [5], [6], [7], [8], [9]]
Run Code Online (Sandbox Code Playgroud)

获取如下所示的列表的正确方法是什么:

[10, 5, 6, 7, 8, 9]
Run Code Online (Sandbox Code Playgroud)

python string list

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

标签 统计

python ×2

clojure ×1

list ×1

macos ×1

pip ×1

string ×1

virtualenv ×1