Skip to content

Instantly share code, notes, and snippets.

@zoltanctoth
Last active October 21, 2020 10:28
Show Gist options
  • Save zoltanctoth/bcba05b7edc9852a9ee810013ab6693f to your computer and use it in GitHub Desktop.
Save zoltanctoth/bcba05b7edc9852a9ee810013ab6693f to your computer and use it in GitHub Desktop.
Python print without newline. This script shows how you can use python to print a string without adding a newline.
# Print a string without adding a newline
print("Hey, Python prints without a newline.", end ="")
# Alternative solution
import sys
sys.stdout.write("Hey, Python prints without a newline.")
# You are part of an experiment on how well gists can be used as "StackOverflow".
# Please add a comment or a star if you found this useful. :) Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment