What is the proper way to format a multi-line dict in Python?

后端 未结 7 1468
天命终不由人
天命终不由人 2020-11-29 16:19

In Python, I want to write a multi-line dict in my code. There are a couple of ways one could format it. Here are a few that I could think of:

  1. mydic         
    
    
            
相关标签:
7条回答
  • 2020-11-29 16:47
    dict(rank = int(lst[0]),
                    grade = str(lst[1]),
                    channel=str(lst[2])),
                    videos = float(lst[3].replace(",", " ")),
                    subscribers = float(lst[4].replace(",", "")),
                    views = float(lst[5].replace(",", "")))
    
    0 讨论(0)
提交回复
热议问题