Python Forum
Convert text file date into specific format
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert text file date into specific format
#2
If it is a text you do not need datetime module.
Read the dates and replace '/' with "".

>>> line = "2018/01/02"
>>> line.replace('/', '')
'20180102'
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: Convert text file date into specific format - by wavic - May-11-2018, 05:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare current date on calendar with date format file name Fioravanti 1 315 Mar-26-2024, 08:23 AM
Last Post: Pedroski55
Question [SOLVED] Correct way to convert file from cp-1252 to utf-8? Winfried 8 1,209 Feb-29-2024, 12:30 AM
Last Post: Winfried
  Extracting specific file from an archive tester_V 4 592 Jan-29-2024, 06:41 PM
Last Post: tester_V
  Python date format changes to date & time 1418 4 723 Jan-20-2024, 04:45 AM
Last Post: 1418
Thumbs Up Convert word into pdf and copy table to outlook body in a prescribed format email2kmahe 1 811 Sep-22-2023, 02:33 PM
Last Post: carecavoador
  Color a table cell based on specific text Creepy 11 2,195 Jul-27-2023, 02:48 PM
Last Post: deanhystad
  Convert File to Data URL michaelnicol 3 1,302 Jul-08-2023, 11:35 AM
Last Post: DeaD_EyE
  Formatting a date time string read from a csv file DosAtPython 5 1,438 Jun-19-2023, 02:12 PM
Last Post: DosAtPython
  Python Script to convert Json to CSV file chvsnarayana 8 2,640 Apr-26-2023, 10:31 PM
Last Post: DeaD_EyE
  Review my code: convert a HTTP date header to a datetime object stevendaprano 1 2,086 Dec-17-2022, 12:24 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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