【发布时间】:2020-11-02 22:57:14
【问题描述】:
我正在研究 cs50/pset6/DNA,我想实现这个:# Strip \n from each line and convert comma separated elements into list 我想了解这行的含义:
row = line.rstrip("\n").split(",")
您能解释一下语法的含义以及每个部分的作用吗?谢谢!
【问题讨论】:
-
我明白 rstrip...
-
因为我还是python新手,不知道你可以把这样的两种方法结合起来
-
像
rstrip这样的方法返回没有尾随空格/换行符的字符串,因此您将其存储在变量中,或直接重用它并调用 split() 对其
标签: python python-3.x char cs50