May-03-2017, 08:20 AM
(May-03-2017, 08:02 AM)Mekire Wrote: Well, there doesn't seem to be a way to get the names of the fields from it directly, but they are always in the same order so you can build a dict easily as I showed in the previous post.
i really didn't understand your post. i don't even understand this one. you are saying it can't be done but your code does it easily? to build a dict you need to get the keys. how do you get the keys? apparently we can't use vars("). do you know of anything simpler than:
Output:lt1/forums /home/forums 12> py3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> [x.split('=')[0] for x in repr(sys.version_info).split('(')[1].split(')')[0].split(', ')]
['major', 'minor', 'micro', 'releaselevel', 'serial']
>>>
which is the kind of "parsing" i was referring to.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.