Home  >  Q&A  >  body text

python - pycharm 如何默认不换行

merge 代码后,一行的代码会自动换行,folding什么的更改了也不行,有谁知道怎么设置吗

PHPzPHPz2740 days ago809

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-18 10:11:04

    1. Your code is obviously not standardized. There is a dotted line at the end. You don’t break the line and continue writing. This is very unpythonic;

    > 其他人看这样的代码,瞟一眼就不会想继续看的

    2. I have used pycharm for so long, and I have never encountered it automatically wrapping lines unless it is automatically formatted;
    3. Please be familiar with using Ctrl+Alt+F to format code;

    Like the following line of code, if there is no line break, then when someone uses vim to read the code, they have to scroll a few screens to finish reading this line?

    objects_data = Task \
                .objects.filter(state=0)\
                        .filter(asset__in=assets)\
                        .filter(Q(name__icontains=q) |
                                Q(user__username__icontains=q) |
                                Q(app_version__name__icontains=q) |
                                Q(asset__hostname__icontains=q)).all() \
                if q is not None else \
                Task.objects.filter(state=0).filter(asset__in=assets).all()

    reply
    0
  • Cancelreply