Python Forum
What does ty(val) mean?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What does ty(val) mean?
#1
In the following code:
>>> line='yosi, 1, 3.14'
>>> types=[str, int, float]
>>> raw=line.split(',')
>>> raw
['yosi', ' 1', ' 3.14']
>>> fields = [ty(val) for ty,val in zip(types,raw)]
>>> fields
['yosi', 1, 3.14]
What do ty and val refer to?
Reply


Messages In This Thread
What does ty(val) mean? - by liagym - May-04-2020, 09:09 AM
RE: What does ty(val) mean? - by anbu23 - May-04-2020, 09:29 AM
RE: What does ty(val) mean? - by buran - May-04-2020, 11:52 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020