|
|
Subscribe / Log in / New account

Linux distributions and Python 2

Linux distributions and Python 2

Posted Jun 14, 2018 6:18 UTC (Thu) by lambda (subscriber, #40735)
In reply to: Linux distributions and Python 2 by Kamilion
Parent article: Linux distributions and Python 2

Which interpreter is the right one to use for the following code in an executable file named polyglot:

#!/usr/bin/python

print("2/3 = {}".format(2/3))

Will the output remain the same if one system decides to run it with a Python 2 interpreter and another runs it with a Python 3 interpreter?


to post comments

Linux distributions and Python 2

Posted Oct 2, 2018 9:09 UTC (Tue) by cclauss (guest, #127609) [Link]

Adding from __future__ import division will print a fractional result in both Python 2 and Python 3.

Changing / --> // will print zero in both Python 2 and Python 3.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds