【Python】'Too large to show contents. Max items to show: 300'


使用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盤,需要以管理員模式編輯。

 

 

 

 

待續...

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM