场景:由于SQL查询,您有一个长元组,并希望将其解压缩为单个值.符合PEP8的最佳方法是什么?到目前为止,我有以下三种选择:
单个赋值,使用反斜杠分割为多行
person_id, first_name, last_name, email, \
birth_date, graduation_year, home_street, \
home_city, home_zip, mail_street, mail_city, \
mail_zip = row
Run Code Online (Sandbox Code Playgroud)单个赋值,在parantheses中分组左侧和没有反斜杠的断行
(person_id, first_name, last_name, email,
birth_date, graduation_year, home_street,
home_city, home_zip, mail_street, mail_city,
mail_zip) = row
Run Code Online (Sandbox Code Playgroud)分成多个分配,每个分配成一行
person_id, first_name, last_name, email = row[0:4]
birth_date, graduation_year, home_street = row[4:7]
home_city, home_zip, mail_street, mail_city = row[7:11]
mail_zip = row[11]
Run Code Online (Sandbox Code Playgroud)三个选项中哪一个最好?有更好的吗?