I’m fairly new to Python, I still have not finished my first Python tutorial. Sometimes it’s easier to share longer code (50+ lines) on a code sharing website. Besides pastebin.com, what are recommended code sharing sites when asking questions on a forum about Python?
EDIT: I was thinking of code longer than 50 lines when using an external code site.
On this forum, it’s best to first condense your code down to the minimum that you need to share to ask your question, then just paste it into the message body within code fences (triple backticks, also accessible from the </> button in the formatting bar). For other forums, it’s up to their rules
If you’re somewhere where you need long code and can’t embed it, I’d use dpaste.com, as that’s recommended by sopython and doesn’t annoy with ads like pastebin.com does.
(Uh… actually I’ve been using dpaste.org, as I thought that was the one they recommended. But both look alright.)
And I often use Attempt This Online since that lets people run the code there, with a relatively new Python version and no ads. And its copy-button gives me both the code and a link, e.g.:
“Attempt this online” has Python and Python 2 but no Python 3. I just did a language search for “Python”. I have Python 3.12. Does it support Python 3 but it’s called “Python”?
EDIT: Never mind, “Python” is Python 3.11.4. I did this.
import sys
print ('Python %s on %s' % (sys.version, sys.platform))