使用Python操作MySQL,需要批量获取上万条数据,并把结果返回写入文件;
遇到问题:'Too large to show contents. Max items to show: 300'
解决办法如下:
在pycharm中debug时,如果len(list)>300,会提示too long to print,无法查看list[300]以后的参数,此时修改pycharm的配置文件即可,方法如下:
进入到pycharm安装目录下并编辑下述文件
>helpers/pydev/_pydevd_bundle/pydevd_resolver.py
修改MAX_ITEMS_TO_HANDLE为你需要的值即可
不建议改的太大,不然会很卡
这个文件路径一般在这里:C:\Program Files\BEN\JetBrains\PyCharm 2018.3.4\helpers\pydev\_pydevd_bundle
详见:pydevd_resolver.py
参见如下:
try: import StringIO except: import io as StringIO import traceback from os.path import basename from _pydevd_bundle import pydevd_constants from _pydevd_bundle.pydevd_constants import dict_iter_items, dict_keys, xrange # Note: 300 is already a lot to see in the outline (after that the user should really use the shell to get things) # and this also means we'll pass less information to the client side (which makes debugging faster). MAX_ITEMS_TO_HANDLE = 300 TOO_LARGE_MSG = 'Too large to show contents. Max items to show: ' + str(MAX_ITEMS_TO_HANDLE) TOO_LARGE_ATTR = 'Unable to handle:'
改文件第14行修改即可。
如果在C盘,需要以管理员模式编辑。
待续...