473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Check some string with timestamp is there or not in csv

Hai
from csv file ,i want to check some string is there or not with some time stamp
Apr 25 '07 #1
1 1579
bvdet
2,851 Expert Mod 2GB
Hai
from csv file ,i want to check some string is there or not with some time stamp
This finds a date with a format of dd/dd/dd (dd stands for one or more digits) in a file:
Expand|Select|Wrap|Line Numbers
  1. import re
  2. patt = r'\d+/\d+/\d+'
  3. f = open('data_file')
  4. for line in f:
  5.     if re.search(patt, line):
  6.         f.close()
  7.         break
  8. print line
  9.  
  10. # 295,343,83,25,FC,3,1,0,C,12/06/2007,D342,0,0,530019
Expand|Select|Wrap|Line Numbers
  1. import re
  2. patt = r'\d+/\d+/\d+'
  3. deteList = re.findall(patt, open('data_file').read())
  4. print dateList
  5.  
  6. # ['12/06/2007']
Apr 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: collincm | last post by:
Hi, I am trying to optimize a table for inserts. Half of the timeron cost is in the FK lookup! These tables for example CREATE TABLE FOO2( FOO2_ID INTEGER NOT NULL CONSTRAINT FOO2_PK...
5
by: Anthony Robinson | last post by:
Consider the following tables: CREATE TABLE "AIMD "."CHANNELSESSION" ( "CHANNELSESSIONID" DECIMAL(13,0) NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +1 , INCREMENT BY +1 , CACHE 20 ) ,...
10
by: Reiner Merz | last post by:
Hi, I'm looking for advice on how to parse a timestamp string according to the ISO 8601 specification. For those unfamiliar with the standard, here's an example: 2003-09-09T23:00:00Z...
2
by: Russell Smith | last post by:
Timestamps support infinity. However if appears dates do not. When timestamps are cast to dates, there is no output. Is this an acceptable option or not? Below are a number of examples...
1
by: Clodoaldo Pinto Neto | last post by:
Hi all, I want to have the time zone string (like 'BRT') displayed after a date-time. The date column is of the type timestamp with time zone. But the time zone is not displayed. It works for...
2
by: V_S_H_Satish | last post by:
Dear Friends I am working as oracle and ms sql dba from last 4 years. My company recently migrated to DB2 databases. So i am very much new to db2 database Can any one pls provide script to...
4
by: sturnfie | last post by:
Hey all, I recently came across the xml.sax libraries and am trying to use them. I am currently making a string variable, and am attempting to pass it into a parser instance as follows: def...
10
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these...
11
by: aisling.cronin | last post by:
Hi I am using ctime to convert the following string 1144412677847 .... Please could some one to double check if they get the same result as me (The Time is Sun Nov 02 09:11:51 2031). It seems...
4
by: theoni | last post by:
Hello all, I am using a script to export database values to xls. I am using an if statement to check if the value is numeric and has a length of ten digits. My problem is that when I extract the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.