PyCharm select by column

1. Method

        Expected effect: Select a certain part of the code by column box.

        Shortcut key trick: 【Shift+Alt+left mouse button】Marquee selection.

        actual effect:

        Differences from normal selection:

Two, reference

        I glanced at this blog, but I didn’t understand it, because the insert key is too far away from alt and shift: pycharm selects a single column shortcut key

Three, PyCharm environment

4. Source code under test

# Definition of Linked List
class ListNode:
    def __init__(self, value, next_node=None):
        if isinstance(value, int):
            self.value = value
            self.next_node = next_node
        elif isinstance(value, list):
            self.value = value[0]
            self.next_node = None
            head = self
            for i in range(1, len(value)):
                node = ListNode(value[i])
                head.next_node = node
                head = head.next_node

# Solution for Reverse of Linked List
class Solution:
    @staticmethod
    def reverse_list(head: ListNode) -> ListNode:
        prev = None
        curr = head
        while curr is not None:
            nex = curr.next_node
            curr.next_node = prev
            prev = curr
            curr = nex
        return prev

# Test Case
if __name__ == '__main__':
    a_list = [100, 20, 3, 4, 5]
    h = ListNode(a_list)
    s = Solution()
    reversed_h = s.reverse_list(h)
    c = reversed_h
    while c:
        print(c.value)
        c = c.next_node

Guess you like

Origin blog.csdn.net/qq_36158230/article/details/128943845