class test:
def __init__(self, val):
self.val = val
self.val.lower()
Run Code Online (Sandbox Code Playgroud)
为什么lower()不对此代码中的val内容进行操作?
使用wolfram alpha api时,Python会抛出这个:
Traceback (most recent call last):
File "c:\Python27\lib\threading.py", line 530, in __bootstrap_inner
self.run()
File "c:\Python27\lib\site-packages\Skype4Py\utils.py", line 225, in run
handler(*self.args, **self.kwargs)
File "s.py", line 38, in OnMessageStatus
if body[0:5] == '!math':wolfram(body[5:], '')
File "s.py", line 18, in wolfram
print "l: "+l
File "c:\Python27\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\xd7' in position 3
: character maps to <undefined>
Run Code Online (Sandbox Code Playgroud)
我该怎么解决这个问题?
我永远不知道怎么读这些.如果有人可以帮助我理解这个,并且可能就如何阅读这些内容提供建议会很有帮助吗?
D:\>python captain2.py
Traceback (most recent call last):
File "captain2.py", line 2, in <module>
from twisted.internet import reactor
File "c:\Python27\lib\site-packages\twisted\internet\reactor.py", line 37, in
<module>
from twisted.internet import default
File "c:\Python27\lib\site-packages\twisted\internet\default.py", line 50, in
<module>
install = _getInstallFunction(platform)
File "c:\Python27\lib\site-packages\twisted\internet\default.py", line 46, in
_getInstallFunction
from twisted.internet.selectreactor import install
File "c:\Python27\lib\site-packages\twisted\internet\selectreactor.py", line 1
4, in <module>
from zope.interface import implements
ImportError: No module named zope.interface
Run Code Online (Sandbox Code Playgroud) 试图将 python 脚本推送到 heroku,它抱怨我的 pipfile.lock 已过时。我正在使用 pipenv 来管理依赖项,并且我尝试运行 pipenv lock 来更新锁定文件无济于事。
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 2.39 KiB | 817.00 KiB/s, done.
Total 11 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Found python-3.6.5, removing
remote: -----> Installing python-2.7.15
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 11.8.2.
remote: …Run Code Online (Sandbox Code Playgroud)