大家平时都怎么命名 split 后的变量

2022 年 9 月 15 日
 jtsr

比如 for line in f.readlines(): 第一种 line = line.split(' ') 第二种 line_lst = line.split(' ') 第三种 res = line.split(' ') or other

4852 次点击
所在节点    Python
35 条回复
C02TobNClov1Dz56
2022 年 9 月 15 日
xxxSp
joApioVVx4M4X6Rf
2022 年 9 月 15 日
items ?
otakustay
2022 年 9 月 15 日
parts 、items 、segments 、fragments
kongkongyzt
2022 年 9 月 15 日
chunks
plams
2022 年 9 月 15 日
line_split = line.split('\t')
wanguorui123
2022 年 9 月 15 日
var aArray=a.split('')
keepeye
2022 年 9 月 15 日
我一般用 xxxSegments
tomwei7
2022 年 9 月 15 日
ss, vv, {xx}s
abc0123xyz
2022 年 9 月 15 日
a1,a2,a3...an
mritd
2022 年 9 月 15 日
ss = s.split(",")
efaun
2022 年 9 月 16 日
使用 ide 提取变量功能的自动命名
git00ll
2022 年 9 月 16 日
a
hhhhhh123
2022 年 9 月 16 日
个人习惯命名: 列表:xx_lst, 字典: xx_dit. 集合: xx_set. 所以 split 后是列表 , 故 xx_lst
rev1si0n
2022 年 9 月 16 日
如果是已知数量的 split ,看情况使用 a, b, c = xx.split(),如果每个字段有含义的话,会用含义来命名。未知数量,就像上面别人那样,看含义比如 words = xx.split()
craiiz
2022 年 9 月 19 日
非程序。看情况。像你这种,如果是预料到以后会再看, 我都是用 words 、words_list ;否则就是 ss, aa, bbbb 之类的。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://study.congcong.us/t/880180

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX