Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2305
| References | <mailman.42.1301603750.2990.python-list@python.org> <493bab97-ec24-450d-8366-5e8302b57181@glegroupsg2000goo.googlegroups.com> |
|---|---|
| Date | 2011-03-31 14:57 -0700 |
| Subject | Re: Learn Python the Hardway exercise 11 question 4 |
| From | geremy condra <debatem1@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.48.1301608656.2990.python-list@python.org> (permalink) |
On Thu, Mar 31, 2011 at 2:43 PM, eryksun () <eryksun@gmail.com> wrote: > On Thursday, March 31, 2011 4:35:42 PM UTC-4, Chris Angelico wrote: >> >> I was trolling, I know the reasons behind it. Anyway, most people >> don't share code by email! (Actually, since you seem to be the author >> of that page - could you address that particular point? I think it's >> probably as big an issue as any of the others, to today's coders - >> "code semantics get destroyed by forums/email/etc/etc/etc".) >> >> Solution: All emailed code should begin with >> from __future__ import braces >> And there you are, out of your difficulty at once! > > You could paste it as a base64 stream, such as: > > >> ZGVmIHNwYW0oKToNCiAgICBwcmludCAiU3BhbSEg >> TG92ZWx5IHNwYW0hIExvdmVseSBzcGFtISI= > > > Then decode and exec: > > In [1]: import base64 > > In [2]: %cpaste > Pasting code; enter '--' alone on the line to stop. > :code="""> ZGVmIHNwYW0oKToNCiAgICBwcmludCAiU3BhbSEg > :> TG92ZWx5IHNwYW0hIExvdmVseSBzcGFtISI=""" > :-- > > In [3]: print base64.b64decode(code) > def spam(): > print "Spam! Lovely spam! Lovely spam!" > > In [4]: exec(base64.b64decode(code)) > > In [5]: spam() > Spam! Lovely spam! Lovely spam! I know it's tongue-in-cheek, but please, please, please don't do this. Geremy Condra
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Learn Python the Hardway exercise 11 question 4 "eryksun ()" <eryksun@gmail.com> - 2011-03-31 14:43 -0700
Re: Learn Python the Hardway exercise 11 question 4 geremy condra <debatem1@gmail.com> - 2011-03-31 14:57 -0700
Re: Learn Python the Hardway exercise 11 question 4 Chris Angelico <rosuav@gmail.com> - 2011-04-01 09:14 +1100
Re: Learn Python the Hardway exercise 11 question 4 John Bokma <john@castleamber.com> - 2011-03-31 17:08 -0600
csiph-web