On Wed, 25 Jan 2017 at 17:07 Alan Gauld via Tutor <tutor@python.org> wrote:
> On 25/01/17 02:55, source liu wrote: > > > 2.7. (2.7.16 if I remembered it correctly), one could run python script > > with perl > > > > $cat test.py > > #!/bin/env python > > print "I am python" > > > > > > $perl test.py > > I am python > > > > That is just because this particular print statement > is compatible with Perl. If you had tried anything > more complex then it would have bombed. > How to you define complex? The script import lots of modules such as urllib2 > > > But it would fail if you tried to use python2.6(which go with rhel6.8) > > I'm not sure what you mean here but you could run the > code above in any version of Python v2 or perl and > it should work. The first6 line is a comment so > ignored by both perl and python. And the print > statement works in both languages. My fault, the PYTHONPATH is not correct with my Python 2.6 , which misleading me to think Python 2.6 can't do this > > -- > Alan G > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > http://www.amazon.com/author/alan_gauld > Follow my photo-blog on Flickr at: > http://www.flickr.com/photos/alangauldphotos > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- Liu An Institution of modern physics, Shanghai, China _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor