Comments (4)
This issue is not related to tabulate. You have created a set with dictionaries. The elements of a set must be immutable object: number, string, tuple.
You need to create a list or tuple of dictionaries (square brakets or parentheses), then everything will work
data = [{'IP': '15.0.15.1',
'Interface': 'FastEthernet0/0',
'Protocol': 'up',
'Status': 'up'
},
{'IP': '10.0.12.1',
'Interface': 'FastEthernet0/1',
'Protocol': 'up',
'Status': 'up'},
{'IP': '100.0.0.1',
'Interface': 'Loopback100',
'Protocol': 'up',
'Status': 'up'}]
print(tabulate(data, headers='keys'))
from pyneng-book-en.
Still it returns error:
Traceback (most recent call last):
File "/Users/Retina/PycharmProjects/python-start/Play.py", line 17, in
print(tabulate(data, headers='key'))
File "/Users/Retina/Library/Python/3.8/lib/python/site-packages/tabulate.py", line 1426, in tabulate
list_of_lists, headers = _normalize_tabular_data(
File "/Users/Retina/Library/Python/3.8/lib/python/site-packages/tabulate.py", line 1073, in _normalize_tabular_data
raise ValueError(
ValueError: headers for a list of dicts is not a dict or a keyword
from pyneng-book-en.
Typo in headers (keyS):
headers='keys')
from pyneng-book-en.
You are right, sorry for bothering with typo.
By the way your book is quit good!
from pyneng-book-en.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyneng-book-en.