Commit fb9ec54f by BellCodeEditor

auto save

parent 5ec53ebb
Showing with 10 additions and 0 deletions
with open(r'c:\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines() # 一次性读取多行,返回的结果是一个列表
#print(a)
for i in a:
b=i.split()
print(b[1:])
\ No newline at end of file
想被分开的字符str.split()
括号里填分隔符号,默认为空格
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment