Python Forum
find some word in text list file and a bit change to them
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
find some word in text list file and a bit change to them
I need to find some word in my text list file for example V_20220412 in

then i want to omit " _" so then , it is like this: V20220412
and then i want to get one day before this date : V20220411
after doing these steps for all rows in text list file ,I want to save them in another text file like this:
Use "re" (regular expression) to find the desired string. Use "datetime" to do date arithmetic.
Show us your program, and we will help you.
ndc85430 likes this post
Are you searching for exactly V_20220412or do you need every occurrence of an eight character sequence that begins withV_or something else?
first of all i appreciate your help (you and ibreeden) and as you can see in my file names in text list file (below) the date repeated 2 times in every file names (in fore example text list file) but with different times (T= time) i need just date with letter V before because i need the text file that you named it before : "pattern_list.txt" ( your previous code for solving my previous post ) in
so i know you understand what i exactly need (good job) .i have tried to say my problem in two parts(2 posts) because i say these 2 posts in one question , many times ago and i cannot get answer of any body.
so for every rows in my text list file (or every file name) , i need to find just one repeated date joined with V and then subtract one day fore all of them (so it should be formatted as date ):

Possibly Related Threads…
Thread Author Replies Views Last Post
  Replace a text/word in docx file using Python Devan 4 2,243 Oct-17-2023, 06:03 PM
Last Post: Devan
  Find a specific keyword after another keyword and change the output sgtmcc 5 676 Oct-05-2023, 07:41 PM
Last Post: deanhystad
  Program to find Mode of a list PythonBoy 6 907 Sep-12-2023, 09:31 AM
Last Post: PythonBoy
  logging: change log file permission with RotatingFileHandler erg 0 848 Aug-09-2023, 01:24 PM
Last Post: erg
  FileNotFoundError: [WinError 2] The system cannot find the file specified NewBiee 2 1,386 Jul-31-2023, 11:42 AM
Last Post: deanhystad
  How can I change the uuid name of a file to his original file? MaddoxMB 2 775 Jul-17-2023, 10:15 PM
Last Post: Pedroski55
  Change font in a list or tuple apffal 4 2,570 Jun-16-2023, 02:55 AM
Last Post: schriftartenio
  find random numbers that are = to the first 2 number of a list. Frankduc 23 2,849 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  Cannot find py credentials file standenman 5 1,483 Feb-25-2023, 08:30 PM
Last Post: Jeff900
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 876 Feb-15-2023, 05:34 PM
Last Post: zsousa

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020