3

I am currently re-structuring my Python Code using PyCharm. I am often in the situation that I have to "move" many lines of code due to the indentation mechanism of Python. Moving lines of code "forward" is easy, as I just mark the lines and press "Tab", but I don't know how to do it "backwards"?

To make it clear consider a simple example for the structure problem:

for in_file in os.listdir(os.curdir):

    input_file = open(in_file, 'r')
    in_data = input_file.read().split("\n")

    print "Processing Data ..."

    in_array = []

    for line in in_data:

           converted_ts = to_timestamp(line)
           in_array.append(converted_ts)

When I remove the first line I have to move all other lines backwards. I guess there is a simple trick to do this and I hope that someone can actually help me.

3

How do I unindent lines?

Unindent Selection Shift+Tab Move the selected block to the previous indentation level.

Source Basic Editing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.