Copy paste with line number in visual studio code?

how copy my code with its line number i cant do it in visual studio code
edit:someone said that mostly code number is useless but yet also it could be important when addressing code line while working on problems so do anyone know a way

The line numbers are not relevant for the code operation and therefore could be meaningless. They’re simply there for local code analysts, such as callback error reporting and an easy way for us humans to see the code, so to speak.

1 Like

yeah but just for the callback it can appear very useful so do you know how to put numbers automatically for code lines ?

Please explain why you want to do this…otherwise when someone says, “take a screen-shot” you might respond to such assistance with “no, because…”

Maybe you’d have better chances asking in a Visual Studio Code discussion forum rather than in a Python one.

Maybe, you mean to ask about some code error or other? In which case you’d simply create a code block area, within your ‘post’, such as:

# your code would be here
...
...
...

And then ask, something like: “Could someone please tell me why I’m seeing this error?”

File "/home/rob/Desktop/python/temp/temp.py", line 19, in <module>
  for name_l2 in names[name_tl][name_l1]:

builtins.TypeError: 'NoneType' object is not iterable

As you can see, the trace back not only tells you what the line number is, but it also shows the actual codeline, which is the relevant part; the line number is purely incidental.

That could read: ..., line 1254, in... and it would make no difference.

Clearly, it would be nuts to post up 1300 lines of code, just to show the relevant code block; you’d simply post up the relevant code.