TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dipa Mehta
149
12.6k
499.8k
Dictionary in Python
Nov 20 2019 1:01 PM
Is there a way to refactor the following Python code so that the number of lines in generation of the dictionary can be reduced?
data = frame[
'data'
].split(
';'
)
cat_data = {
'xbee_address'
:
'\x00'
+ frame[
'source_addr'
],
'state'
: data[
0
],
'flow_rate'
: data[
1
],
'operating_hours'
: data[
2
],
'operating_minutes'
: data[
3
],
'operating_seconds'
: data[
4
],
'hours_until_maintenance'
: data[
5
],
'number_of_cleansing'
: data[
6
],
'serial_number'
: data[
7
],
'item_number'
: data[
8
],
'month_of_manufacturing'
: data[
9
],
'year_of_manufacturing'
: data[
10
],
'software_version'
: data[
11
],
}
Reply
Answers (
2
)
Making your ID element not to duplicate data in Jquery
Attribute Selector Select