Posting code on stackoverflow

Roel Schroeven roel at roelschroeven.net
Sat Jun 5 19:00:17 EDT 2021


Rich Shepard schreef op 5/06/2021 om 23:36:
> I tried to post a question on stackoverflow.com which included a bunch of
> code (entered after clicking the box 'code'). I noticed that lines were
> wrapped but could not find how to expand the input box so they would not
> wrap.
> 
> SO wouldn't let me post the question because of the wrapped code. As I've
> not asked a question ther for a long time, and it didn't involve long lines
> of code, I need to learn a) how to enter code if it's not just clicking on
> the 'code' box before pasting text and b) how to keep code lines from
> wrapping so a horizontal scroll bar is made available.

There are several ways to format code on StackOverflow, see 
https://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks

What I do most of the time is indent the code by 4 spaces and make sure 
there are blank lines before and after the code block.



-- 
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
         -- Franklin P. Jones

Roel Schroeven



More information about the Python-list mailing list