how do you post code? It keeps truncating the lines
There is no reason I can think of that you couldn't post your code, however if you are having issues you can always use pastebin or a similar service.
As eSpeX pointed out, there is pastebin. There is a similar thing on github. Where these come in VERY handy is when someone else wants to try your code. If I copy and paste a code sample people put on OS, it removes all the carriage returns. So for longer code samples, this makes things VERY hard to work with. If you use a code or text keeping service, this can eliminate the problem. That makes it much easier on people that want to try your code to debug it.
For the Mechanical MOOC, we recommend GitHub's Gist (github.com)
- http://dpaste.com - http://pastebin.com - http://www.repl.it/ - http://pastie.org - http://codepad.org - http://ideone.com paste your code there and post the link here. select Python syntax highlighting when u paste.
you may attach it by file
``` # indent your Python code to put into an email import glob # glob supports Unix style pathname extensions python_files = glob.glob('*.py') for file_name in sorted(python_files): print ' ------' + file_name with open(file_name) as f: for line in f: print ' ' + line.rstrip() print ``` It looks like ``` above and below a block also causes code to paste properly, and retain format on copy back. It turns on the preformatted text mode!
Join our real-time social learning platform and learn together with your friends!