How do I copy python code with line numbers?

A forum for general discussion of the Python programming language.

How do I copy python code with line numbers?

Postby josh623 » Tue Apr 08, 2014 4:22 am

Hey guys! I found this forum by googling it because I am trying to learn code and will definitely need help on this journey! I love forums because like minded people can share ideas and help each other along the way without being local. Anyway...

If I am going to be posting here I need to know the right way to do it... I see a lot of posts where people copy a section of code into a thread/post that has line numbers so you can refer to a specific line when discussing it... how do I do this?

I am using Linux Mint with Gedit text editor. Thanks guys!
Last edited by Mekire on Tue Apr 08, 2014 4:37 am, edited 1 time in total.
Reason: First post lock.
josh623
 
Posts: 13
Joined: Tue Apr 08, 2014 4:15 am

Re: How do I copy python code with line numbers?

Postby Mekire » Tue Apr 08, 2014 4:44 am

Our code tags, as they currently stand, do not support line numbers (as far as I know).
When posting asking for assistance here, you are encouraged to try to reduce your code to a small working example that illustrates the issues you are having. When posting code be sure to use code tags. Simply press the "Code" button in the post toolbar and paste your code between.).

If you have a large project you would like to share or have reviewed and feel that pasting the code directly into a post would be inappropriate we would prefer you to use a github repository (or other code oriented hosting site).

Anyway, welcome to the forums.
-Mek
User avatar
Mekire
 
Posts: 1025
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: How do I copy python code with line numbers?

Postby Kebap » Tue Apr 08, 2014 10:16 am

josh623 wrote:I see a lot of posts where people copy a section of code into a thread/post that has line numbers so you can refer to a specific line when discussing it...

Hey, welcome! Can you show an example?
Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 397
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: How do I copy python code with line numbers?

Postby josh623 » Tue Apr 08, 2014 11:49 pm

Well I guess now that I look at it, most people just use the code tags =)

but how does this guy do it? http://learnpythonthehardway.org/book/ex16.html
josh623
 
Posts: 13
Joined: Tue Apr 08, 2014 4:15 am

Re: How do I copy python code with line numbers?

Postby Yoriz » Wed Apr 09, 2014 12:11 am

But that is not a forum post its a totaly seperate website.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Image
User avatar
Yoriz
 
Posts: 1049
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: How do I copy python code with line numbers?

Postby micseydel » Wed Apr 09, 2014 12:20 am

Wow, when did LPTHW get so heavy on the ads? Jeez.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1443
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: How do I copy python code with line numbers?

Postby Mekire » Wed Apr 09, 2014 12:39 am

josh623 wrote:Well I guess now that I look at it, most people just use the code tags =)

but how does this guy do it? http://learnpythonthehardway.org/book/ex16.html

Generally people use javascript syntax highlighters when embedding code on websites if you are really interested.

-Mek
User avatar
Mekire
 
Posts: 1025
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: How do I copy python code with line numbers?

Postby stranac » Wed Apr 09, 2014 12:48 am

I was thinking of making a greasemonkey script that would add (python) syntax highlighting to this forum for a while, but I decided that I like the way things are now, gray on grey(or maybe it's the other way around?)
I can live with this until someone does something to change it(yes, I mean jkbbwr).
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1212
Joined: Thu Feb 07, 2013 3:42 pm


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest