# -*- coding: utf-8 -*-
sj='C:\\Users\\wt271\\Desktop\\jc\\passenger.txt'
sa=[]
with open(sj) as b:
sjj=b.read()
def s(ss,n):
return [ss.append(sjj[i]) for i in sjj if i%n==0]
s(sa,3)
print(sa)cmd运行后如下C:\Users\wt271>python C:\Users\wt271\Desktop\sj.pyTraceback (most recent call last): File "C:\Users\wt271\Desktop\sj.py", line 10, in <module> s(sa,3) File "C:\Users\wt271\Desktop\sj.py", line 9, in s return [ss.append(sjj[i]) for i in sjj if i%n==0] File "C:\Users\wt271\Desktop\sj.py", line 9, in <listcomp> return [ss.append(sjj[i]) for i in sjj if i%n==0]TypeError: not all arguments converted during string formatting
添加回答
举报
0/150
提交
取消