print list of tuples without brackets python

dogacanb

I have a list of tuples and I want to print flattened form of this list. I don't want to transform the list, just print it without parenthesis and brackets.

input: [ ("a", 1), ("b",2), ("c", 3)]
output:   a 1 b 2 c 3

Here's what I do:

l = [ ("a", 1), ("b",2), ("c", 3)]
f = lambda x: " ".join(map(str,x))
print " ".join(f(x) for x in l)

I'm interested in if anybody has a more elegant and possibly a more efficient solution,possibly without doing join, only print. Thanks in advance.

Padraic Cunningham
from __future__ import print_function 

l =  [("a", 1), ("b",2), ("c", 3)]

print(*(i for j in l for i in j))
a 1 b 2 c 3

Or using itertools.chain to flatten:

from itertools import chain

print(*chain(*l))

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to print a list of tuples with no brackets in Python

From Dev

How to print a list of tuples with no brackets in Python

From Dev

how to print a tuple of tuples without brackets

From Dev

Print List of Lists without brackets

From Dev

Python print a list of strings horizontally without quotations or brackets

From Dev

How can i print a list without the brackets?

From Dev

Python dict of lists of tuples. print list of element from tuples

From Dev

print array without brackets

From Dev

Python list write to CSV without the square brackets

From Dev

(Python) adding a list to another without the brackets

From Dev

Create tab separated print output from a list of tuples python

From Dev

Why does it not print a list of tuples with no repeated tuples?

From Dev

Why does it not print a list of tuples with no repeated tuples?

From Dev

Randomizing a list of tuples without random.shuffle() python

From Dev

How to convert a dictionary into a list of tuples without dict functions? [PYTHON]

From Dev

Python convert list of nested tuples to list of tuples

From Dev

How to print a dictionary with multiple values without brackets?

From Dev

python unpacking list of tuples

From Dev

Ordering a list of tuples in python

From Dev

Merging list of tuples in python

From Dev

Python List of tuples in Scala

From Dev

Python Nested tuples to list

From Dev

max in a list of tuples (Python)

From Dev

Merging list of tuples in python

From Dev

comparing a list of tuples python

From Dev

tuples and list arrangements in python

From Dev

Dictionary with list of tuples Python

From Dev

Printing lists without brackets on Python

From Dev

Print values only in list of tuples to csv file

Related Related

HotTag

Archive