Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Python 3

Another take at The Zen of Python, inspired by Maxime's answer Maxime's answer.

import codecs
import os
import sys
import random
stdout = sys.stdout
sys.stdout = open(os.devnull, 'r+')
import this
sys.stdout.close()
sys.stdout = stdout
zen = codecs.decode(this.s, 'rot-13').splitlines()
print(random.choice(zen))

Python 3

Another take at The Zen of Python, inspired by Maxime's answer.

import codecs
import os
import sys
import random
stdout = sys.stdout
sys.stdout = open(os.devnull, 'r+')
import this
sys.stdout.close()
sys.stdout = stdout
zen = codecs.decode(this.s, 'rot-13').splitlines()
print(random.choice(zen))

Python 3

Another take at The Zen of Python, inspired by Maxime's answer.

import codecs
import os
import sys
import random
stdout = sys.stdout
sys.stdout = open(os.devnull, 'r+')
import this
sys.stdout.close()
sys.stdout = stdout
zen = codecs.decode(this.s, 'rot-13').splitlines()
print(random.choice(zen))
Source Link
user344
user344

Python 3

Another take at The Zen of Python, inspired by Maxime's answer.

import codecs
import os
import sys
import random
stdout = sys.stdout
sys.stdout = open(os.devnull, 'r+')
import this
sys.stdout.close()
sys.stdout = stdout
zen = codecs.decode(this.s, 'rot-13').splitlines()
print(random.choice(zen))

AltStyle によって変換されたページ (->オリジナル) /