I'm getting the following userroles from this table using
ResultPydataset=system.db.runQuery("SELECT USERROLES FROM DATABASETABLE WHERE FUNCID='Force Bit'")
I also have a dictionary in my scripting library:
RoleDictionary = {
'0': "Normal",
'1': "Administrator",
'2': "Engineers",
'3': "MM",
'4': "SS",
'5': "CC",
'6': "OO",
'7': "AA",
'8': "EO",
'9': "Supervisor",
'10': "Chargehand",
'11': "Mechanic",
}
How can I create a new dictionary that filters RoleDictionary based on the keys in ResultPydataset?
You had a comma after "Mechanic". Python seems to handle it OK but it shouldn't really be there.
When pasting code use the </> button to format it, preserve indents and apply syntax highlighting. For inline bits of code enclose it in single `backticks`.
Disagree. Trailing commas are a net positive for diffing of lines. With trailing commas, a new entry can be added in a list by only modifying one line. Without trailing commas, adding a new element to the end of a list of entries necessitates modifying two lines.
Can we still be friends?
I understand your thinking. I did find it a problem in SQL query debugging, for example, and resorted to putting the commas on the start of lines so that they could be commented out without generating errors. It was much worse than a trailing comma.