How to change the Blender Console number of spaces used for indentation?
The indent is 4 spaces.



The console indent is 4 spaces.  

&gt;&gt;&gt; C.space_data.prompt
'&gt;&gt;&gt; '


The prompt is ">>> " notice the space at the end, you are counting it as being in indent.  Can select console code and choose "Copy as script" effectively chopping length of prompt from start of each line.

Copy from image pasted here

import bpy
from bpy import data as D
from bpy import context as C
from mathutils import *
from math import *

#~ PYTHON INTERACTIVE CONSOLE 3.8.2 (default, Apr  2 2020, 03:24:36)  [GCC 7.5.0]
#~ 
#~ Builtin Modules:       bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, blf, mathutils
#~ Convenience Imports:   from mathutils import *; from math import *
#~ Convenience Variables: C = bpy.context, D = bpy.data
#~ 
for i in range(20):
    print(i)


Notice it copies all the console buffer and adds the imports, not just the selection.

Would be simple enough to use standard copy and chop 4 from each line of the clipboard.

&gt;&gt;&gt; for line in C.window_manager.clipboard.split("\n"):
...     line[4:]
...     
'for i in range(20):'
'    print(i)'

&gt;&gt;&gt;