扫描页面并替换00:00:00.00的所有实例 [英] scanning through page and replacing all instances of 00:00:00.00
问题描述
我有一个从sql数据库中提取数据的python-cgi文件,我是b / b想知道删除所有实例的最简单方法是什么?
''00 :00:00.00''在我的日期栏中。
如何编写一个python脚本来扫描整个页面并删除所有
个实例'' 00:00:00.00'',我会使用正则表达式吗?
>我有一个python-cgi文件从sql数据库中提取数据,我想知道什么是最简单的方法来删除'00:00:00.00''的所有实例我的日期专栏。
如何编写一个python脚本来扫描整个页面
并删除''00:00:00.00'的所有实例,我会使用
正则表达式?
无需regexp:
someString = someString.replace(&00:00:00.00) ","")
我建议您在打印出值之前执行此操作,
而不是尝试扫描整页之后你会打印出来。
轻松的''nuff。
-tkc >
Kun写道:我有一个从sql数据库中提取数据的python-cgi文件,我想知道是什么是在我的日期列中删除所有
'00:00:00.00'实例的最简单方法。
如何编写python脚本来扫描整个页面并删除所有
'00:00:00.00'的实例,我会使用正则表达式吗?
您可以使用正则表达式,或者您可能想要使用正则表达式看看
美丽的汤 http://www.crummy。 com / software / BeautifulSoup
来解析页面并替换有问题的文本。
-Larry Bates
"坤"写道:
我有一个从sql数据库中提取数据的python-cgi文件,我想知道删除所有
实例的最简单方法是什么'00:00:00.00''在我的日期栏中。
如何编写一个python脚本来扫描整个页面并删除'00:00:00.00的所有
实例'',我会使用正则表达式吗?
umm。如果您正在使用数据库,为什么不在SQL语句中或在构建页面时过滤掉不感兴趣的日期
?
< / F>
I have a python-cgi file that pulls data from an sql database, i am
wondering what is the easiest way to remove all instances of
''00:00:00.00'' in my date column.
how would i write a python script to scan the entire page and delete all
instances of ''00:00:00.00'', would i use regular expressions?
> I have a python-cgi file that pulls data from an sqldatabase, i am wondering what is the easiest way to
remove all instances of ''00:00:00.00'' in my date column.
how would i write a python script to scan the entire page
and delete all instances of ''00:00:00.00'', would i use
regular expressions?
No need for a regexp:
someString = someString.replace("00:00:00.00", "")
I''d recommend doing it before you print the values out,
rather than try and "scan the entire page" after you''ve
printed them.
Easy ''nuff.
-tkc
Kun wrote:I have a python-cgi file that pulls data from an sql database, i am
wondering what is the easiest way to remove all instances of
''00:00:00.00'' in my date column.
how would i write a python script to scan the entire page and delete all
instances of ''00:00:00.00'', would i use regular expressions?
You could use regular expressions or you might want to take a look at
Beautiful Soup http://www.crummy.com/software/BeautifulSoup
to parse the page and replace the offending text.
-Larry Bates
"Kun" wrote:
I have a python-cgi file that pulls data from an sql database, i am
wondering what is the easiest way to remove all instances of
''00:00:00.00'' in my date column.
how would i write a python script to scan the entire page and delete all
instances of ''00:00:00.00'', would i use regular expressions?
umm. if you''re using a database, why not filter out uninteresting dates either
in the SQL statement, or when you''re building the page ?
</F>
这篇关于扫描页面并替换00:00:00.00的所有实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!