2020.10.25 删除文本的标点并转换成列表
2020.10.25 删除文本的标点并转换成列表
要求:
从文本中删除标点符号并将最终产品转换为列表
代码:
# 从文本中删除标点符号并将最终产品转换为列表:
# On a dark desert highway, cool wind in my hair Warm smell of colitas, rising up through the air Up ahead in the distance, I saw a shimmering light My head grew heavy and my sight grew dim I had to stop for the night There she stood in the doorway; I heard the mission bell And I was thinking to myself, "This could be Heaven or this could be Hell" Then she lit up a candle and she showed me the way
# (加州旅馆)text = 'On a dark desert highway, cool wind in my hair Warm smell of colitas, rising up through the air Up ahead in the distance, I saw a shimmering light My head grew heavy and my sight grew dim I had to stop for the night There she stood in the doorway; I heard the mission bell And I was thinking to myself, "This could be Heaven or this could be Hell" Then she lit up a candle and she showed me the way'
for char in ',.;"':text = text.replace(char,'')
print(text.split(' '))
结果:
[‘On’, ‘a’, ‘dark’, ‘desert’, ‘highway’, ‘cool’, ‘wind’, ‘in’, ‘my’, ‘hair’, ‘Warm’, ‘smell’, ‘of’, ‘colitas’, ‘rising’, ‘up’, ‘through’, ‘the’, ‘air’, ‘Up’, ‘ahead’, ‘in’, ‘the’, ‘distance’, ‘I’, ‘saw’, ‘a’, ‘shimmering’, ‘light’, ‘My’, ‘head’, ‘grew’, ‘heavy’, ‘and’, ‘my’, ‘sight’, ‘grew’, ‘dim’, ‘I’, ‘had’, ‘to’, ‘stop’, ‘for’, ‘the’, ‘night’, ‘There’, ‘she’, ‘stood’, ‘in’, ‘the’, ‘doorway’, ‘I’, ‘heard’, ‘the’, ‘mission’, ‘bell’, ‘And’, ‘I’, ‘was’, ‘thinking’, ‘to’, ‘myself’, ‘This’, ‘could’, ‘be’, ‘Heaven’, ‘or’, ‘this’, ‘could’, ‘be’, ‘Hell’, ‘Then’, ‘she’, ‘lit’, ‘up’, ‘a’, ‘candle’, ‘and’, ‘she’, ‘showed’, ‘me’, ‘the’, ‘way’]
2020.10.25 删除文本的标点并转换成列表相关推荐
- 把文本框的值转换成Image
把文本框的值转换成一个Image,很一个很简单的,主要用到的.NET类库是: System.Drawing; 很简单的,先看代码吧: protected void btnConvert_Click( ...
- php+转为文本,PHP将HTML转换成文本的实现代码
PHP将HTML转换成文本的实现代码 核心代码: // $document 应包含一个 HTML 文档. // 本例将去掉 HTML 标记,javascript 代码 // 和空白字符.还会将一些通用 ...
- 使用java将word文档docx,doc(包含图形,文本框)完美转换成所有格式图片(pdf,png,gif,jpeg等等)
使用java将word文档docx,doc(包含图形,文本框,图片等)完美转换成所有格式图片(pdf,png,gif,jpeg等等)下文中附带代码,效果图等 思路 使用到的包 实现代码 效果图: 思路 ...
- 计算机数字怎么转换成文本,怎么把数字转换成文本
大家好,我是时间财富网智能客服时间君,上述问题将由我为大家进行解答. 以WPS为例,把数字转换成文本的方法为: 1.首先使用鼠标左键选中我们想要处理的单元格数据区域. 2.页面的右上角找到智能工具箱, ...
- c语言字节BCD码转换成10进制,如何将BCD码转换成10进制码
今天有人在问我BCD码如何转换成10进制码的问题,其实很简单 BCD 的表示法是 用4个二进制位来表示 一个十进制位,也就是一个字节能够表示2个十进制数位,这是一种压缩的十进制表示方式,应用很广,最常 ...
- JZOJ6828. 【2020.10.25提高组模拟】幂
Description TTT组数据,T≤1e5,n≤1e7T\le1e5,n\le1e7T≤1e5,n≤1e7 Solution 好家伙,最下面的数据范围居然是这样的: 直接以为卡特兰数乘上个组合数 ...
- 神灯系统2020—10.25
神灯系统C#语言实现 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...
- 2020.10.25 对象的创建 利用构造函数创建对象 遍历对象属性 遍历函数属性和属性数值for in 内置对象
输出遵循变量的值就近原则 对象创建方法 : 第一种 var obj = { uname:'dengzhu',//属性的创建,多个属性创建之间用逗号隔开 sex: male; sayHi: functi ...
- 亲测:如何将Sat Mar 14 2020 00:00:00 GMT+0800 (中国标准时间)转换成正常格式yy-MM-dd。字符串日期的比较compareTo方法。
public static void main(final String[] args) { final SimpleDateFormat sdFormat=new SimpleDateFormat( ...
最新文章
- DQL、DML、DDL、DCL的概念
- word文档html图片不能移动,win7系统Word中插入的图片不能移动的解决方法
- 2021年计算机三级新题型,2021年如何通过计算机三级考试的经验
- Form表单基础知识和常用兼容方法笔记(二)
- mac vscode 实用快捷键
- 主成分分析法案例_因子分析案例及操作解析
- YUV格式学习:YUV420P、YV12、NV12、NV21格式转换成RGB24
- CodeForces 297A Parity Game (脑补题)
- [jQuery基础] jQuery案例 -- qq音乐以及初步解决Ajax 跨域问题
- 51nod1363 最小公倍数之和
- vue.js手册_Vue手册:Vue.js的完整介绍
- win7字体安装_超强大PDF编辑软件 | Adobe Acrobat DC安装教程
- 记一篇IT培训日记005-Hello Java
- 小米手机hbuilder开发者模式
- 大数据基础之Spark——Spark pregel详细过程,一看就懂
- 有了它,将大大丰富VR内容,3D VR摄像机Vuze VR开启预定
- java计算机二级知识点、易错点整理(三)
- 搜狐号按作者火车头采集规则
- RabbitMQ的消息补偿机制
- 努力前端【LeetCode-10】448. 找到所有数组中消失的数字 442. 数组中重复的数据(中等) 41. 缺失的第一个正数(困难) [鸽笼原理,数组,Map,类似No.645]
热门文章
- MAC下SecureCRT 8.0.4破解版远程连接工具的安装与配置
- 医学影像组学之病理切片分割(免费训练数据,标注数据,免费代码,免费教程)三天走完影像组学全部流程
- 恢复win10/win11自带文件管理器
- 【论文】Poly-yolo: 改进anchor分配问题
- linux edb 运行不了,运行 Linux 的 IBM Power Systems 上的 EDB Postgres Advanced Server 9.5 入门...
- IP地址段计算方法——计算最大广播地址,最小网络地址
- 二维码的制作Java篇
- Ubuntu 12.04 办公软件简介
- b374k php webshell
- Synchnorized原理详解