博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
coursesa课程 Python 3 programming 输出每一行句子的第三个单词
阅读量:4057 次
发布时间:2019-05-25

本文共 293 字,大约阅读时间需要 1 分钟。

题目:Using the file school_prompt.txt, assign the third word of every line to a list called three

school_prompt = open('school_prompt.txt','r')chars = school_prompt.readlines()three = list()for word in chars:    word = word.split() # 重点,要把字符串转化为列表,不然输出的只是单字母    three.append(word[2])print(three)

转载地址:http://rnrci.baihongyu.com/

你可能感兴趣的文章
IOS开发的开源库
查看>>
IOS开发的开源库
查看>>
Jenkins - sonarqube 代码审查
查看>>
Jenkins + Docker + SpringCloud 微服务持续集成(一)
查看>>
Jenkins + Docker + SpringCloud 微服务持续集成 - 单机部署(二)
查看>>
Jenkins + Docker + SpringCloud 微服务持续集成 - 高可用集群部署(三)
查看>>
Golang struct 指针引用用法(声明入门篇)
查看>>
Linux 粘滞位 suid sgid
查看>>
C#控件集DotNetBar安装及破解
查看>>
Winform皮肤控件IrisSkin4.dll使用
查看>>
Winform多线程
查看>>
C# 托管与非托管
查看>>
Node.js中的事件驱动编程详解
查看>>
mongodb 命令
查看>>
MongoDB基本使用
查看>>
mongodb管理与安全认证
查看>>
nodejs内存控制
查看>>
nodejs Stream使用中的陷阱
查看>>
MongoDB 数据文件备份与恢复
查看>>
数据库索引介绍及使用
查看>>