Skip to content

Instantly share code, notes, and snippets.

@PythonCoderAS
Created May 10, 2022 23:45
Show Gist options
  • Select an option

  • Save PythonCoderAS/9356180553674a4357ae96db5302056b to your computer and use it in GitHub Desktop.

Select an option

Save PythonCoderAS/9356180553674a4357ae96db5302056b to your computer and use it in GitHub Desktop.
Python one-liner to convert a newline-separated list of items into a space-separated list of items
import sys;sys.stdout.write(" | ".join(f"\"{word}\"" for word in sys.stdin.read().split("\n")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment