

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to concatenate a Python dictionary to display all the values together?
You can get all the values using a call to dict.values(). Then you can call ", ".join on the values to concatenate just the values in the dict separated by commas.
example
a = {'foo': "Hello", 'bar': "World"} vals = a.values() concat = ", ".join(vals) print(concat)
Output
This will give the output −
Hello, World
- Related Questions & Answers
- How to zip a Python Dictionary and List together?
- How to print all the values of a dictionary in Python?
- How to get a list of all the values from a Python dictionary?
- How to update a Python dictionary values?
- Python – Concatenate Tuple to Dictionary Key
- MySQL query to display only the empty and NULL values together?
- How to concatenate all values of a single column in MySQL?
- How to replace values of a Python dictionary?
- How to sum values of a Python dictionary?
- How to replace values in a Python dictionary?
- How to print all the keys of a dictionary in Python?
- How to remove all the elements of a dictionary in Python?
- How to sort a dictionary in Python by values?
- How to display all label values in Matplotlib?
- Python Program to Multiply All the Items in a Dictionary
Advertisements