比如 for line in f.readlines(): 第一种 line = line.split(' ') 第二种 line_lst = line.split(' ') 第三种 res = line.split(' ') or other
1
abc612008 2022 年 9 月 15 日 parts
|
2
wudicgi 2022 年 9 月 15 日 parts 就不错
另外不建议用 lst, res 这种缩写 比如 res 可以是 result resource resolution response …… |
3
Leviathann 2022 年 9 月 15 日 words
|
4
Akitora 2022 年 9 月 15 日
idea 叫它 split ,那就 split 吧
|
5
gydi 2022 年 9 月 15 日
line_iter
|
6
cmdOptionKana 2022 年 9 月 15 日 按照英语来说,line = lines.split('\n') 或 words = line.split(' ')
|
7
Zenyet 2022 年 9 月 15 日
splitteds ? 。。。😂
|
8
aaniao002 2022 年 9 月 15 日 via Android
无脑加 s
|
9
optional 2022 年 9 月 15 日 via iPhone
看你业务含义啊,
|
10
Jirajine 2022 年 9 月 15 日
这种临时变量命名宜短不宜长
|
11
jorneyr 2022 年 9 月 15 日
split 得到的数组业务用途是啥,最好名字和业务术语相关。
|
12
wentx 2022 年 9 月 15 日
一样一样,splits
|
13
bianjp PRO pieces
|
14
QKgf555H87Fp0cth 2022 年 9 月 15 日
what is lst
|
15
Runtime3 2022 年 9 月 15 日 via Android
line.split(' ').var ,自动生成,差球不多就行
|
16
itechify PRO xxxSplit
|
17
MoYi123 2022 年 9 月 15 日
line.split(' ') 当然是 words
|
18
calmzhu 2022 年 9 月 15 日
中间临时变量全部...
_ __ ___ |
19
licoycn 2022 年 9 月 15 日 xxxList
xxxArr xxxs xxxTemp |
20
CrazyRundong 2022 年 9 月 15 日 我的习惯是按照被拆分后元素自身的含义命名:
rule_type, rule_arg, destination = "DOMAIN-NAME,google.com,Outside".split(",") 如果没有特别指涉的字符串就叫 tokens: tokens = "foo,bar,baz".split(",") for token in tokens: ... |
21
C02TobNClov1Dz56 2022 年 9 月 15 日
xxxSp
|
22
joApioVVx4M4X6Rf 2022 年 9 月 15 日
items ?
|
23
otakustay 2022 年 9 月 15 日 parts 、items 、segments 、fragments
|
24
kongkongyzt 2022 年 9 月 15 日
chunks
|
25
plams 2022 年 9 月 15 日
line_split = line.split('\t')
|
26
wanguorui123 2022 年 9 月 15 日
var aArray=a.split('')
|
27
keepeye 2022 年 9 月 15 日
我一般用 xxxSegments
|
28
tomwei7 2022 年 9 月 15 日
ss, vv, {xx}s
|
29
abc0123xyz 2022 年 9 月 15 日
a1,a2,a3...an
|
30
mritd 2022 年 9 月 15 日
ss = s.split(",")
|
31
efaun 2022 年 9 月 16 日
使用 ide 提取变量功能的自动命名
|
32
git00ll 2022 年 9 月 16 日
a
|
33
hhhhhh123 2022 年 9 月 16 日
个人习惯命名: 列表:xx_lst, 字典: xx_dit. 集合: xx_set. 所以 split 后是列表 , 故 xx_lst
|
34
rev1si0n 2022 年 9 月 16 日
如果是已知数量的 split ,看情况使用 a, b, c = xx.split(),如果每个字段有含义的话,会用含义来命名。未知数量,就像上面别人那样,看含义比如 words = xx.split()
|
35
craiiz 2022 年 9 月 19 日
非程序。看情况。像你这种,如果是预料到以后会再看, 我都是用 words 、words_list ;否则就是 ss, aa, bbbb 之类的。
|