小编mil*_*lia的帖子

"pip install line_profiler"失败

我打字

sudo pip install "line_profiler"
Run Code Online (Sandbox Code Playgroud)

我明白了

Downloading/unpacking line-profiler
  Could not find a version that satisfies the requirement line-profiler (from versions: 1.0b1, 1.0b2, 1.0b3)
Cleaning up...
No distributions matching the version for line-profiler
Storing debug log for failure in /home/milia/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)

当我使用搜索line_profile时

sudo pip search "line_profiler"
Run Code Online (Sandbox Code Playgroud)

我明白了:

django-debug-toolbar-line-profiler - A panel for django-debug-toolbar that integrates
                        information from line_profiler
line_profiler             - Line-by-line profiler.
tracerbullet              - A line-by-line profiler that doesn't suck.
Run Code Online (Sandbox Code Playgroud)

不知何故,下划线变为" - ".我怎么能绕过那个?

python pip

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

简单的字符串连接失败

我有以下代码:

from yahoo_finance import Currency

symbolslist  = ["EURUSD","EURGBP","EURJPY","EURRUB","USDCAD","USDCHF","AUSUSD"]

for i in range(len(symbolslist)):
        symbol = symbolslist[i]
        nomisma = Currency(symbol).get_rate()

        quota = symbol + " = " + nomisma
        print quota
Run Code Online (Sandbox Code Playgroud)

我得到了结果:

EURUSD = 1.0891
EURGBP = 0.7322
EURJPY = 129.7440
EURRUB = 63.0560
USDCAD = 1.2614
USDCHF = 0.9622
Traceback (most recent call last):
  File "yahoopy.py", line 13, in <module>
    quota = symbol + " = " + nomisma
TypeError: cannot concatenate 'str' and 'NoneType' objects
Run Code Online (Sandbox Code Playgroud)

我知道在这个链接中已经讨论过这个错误.

但我希望我可以克服这个错误而不诉诸mysql.

python string-concatenation python-2.7 yahoo-finance nonetype

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