打开CSV文件时,整数列将转换为字符串值(“ 1”,“ 23”等)。遍历将这些值转换回整数的最佳方法是什么?
import csv
with open('C:/Python27/testweight.csv', 'rb') as f:
reader = csv.reader(f)
rows = [row for row in reader if row[1] > 's']
for row in rows:
print row
Run Code Online (Sandbox Code Playgroud)
CSV文件如下:
import csv
with open('C:/Python27/testweight.csv', 'rb') as f:
reader = csv.reader(f)
rows = [row for row in reader if row[1] > 's']
for row in rows:
print row
Run Code Online (Sandbox Code Playgroud) 我尝试直接从 GitHub ( https://github.com/ethereum/web3.js ) 安装 ethereum/web3.js 存储库,但未安装 devDependency(仅安装依赖项)。我已经尝试过以下方法:
npm install https://github.com/ethereum/web3.js.git
npm install git+https://github.com/ethereum/web3.js.git
npm install ethereum/web3.js
npm install https://github.com/ethereum/web3.js.git --only=dev
npm install git+https://github.com/ethereum/web3.js.git --only=dev
npm install ethereum/web3.js --only=dev
Run Code Online (Sandbox Code Playgroud)
上面的前 3 个命令只会安装 web3.js 的 package.json 文件的依赖项部分中的 5 个依赖项,而 3 个“--only=dev”命令不会安装任何东西。
"dependencies": {
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-
nolookahead.git",
"crypto-js": "^3.1.4",
"utf8": "^2.1.1",
"xhr2": "*",
"xmlhttprequest": "*"
},
Run Code Online (Sandbox Code Playgroud)
当我使用以下命令时,安装了 288 个软件包:
npm install web3
Run Code Online (Sandbox Code Playgroud)
如何使用 GitHub 存储库链接执行相同的安装?