Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
string transformation
#1
Hi,

Could you tell me the most pythonic way to make this transformation:

day='181212'
newday='2018-12-12'
I did this, but I don't like it:
newday = '20' + day[0] + day[1] + '-' + day[2] + day[3] + '-' + day[4] + day[5]
Thanks
Reply


Messages In This Thread
string transformation - by kerzol81 - Apr-22-2018, 09:04 AM
RE: string transformation - by Gribouillis - Apr-22-2018, 09:28 AM
RE: string transformation - by kerzol81 - Apr-22-2018, 12:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  point transformation software in space johnjsi 2 441 Feb-01-2024, 01:31 AM
Last Post: johnjsi
  Calculate transformation and Rotation Sandra2312 1 1,848 Jan-31-2021, 12:53 PM
Last Post: jefsummers
  regular expression for a transformation bluefrog 1 2,972 May-30-2018, 11:53 AM
Last Post: killerrex
  Automation XML transformation vasilysmyslov 0 2,161 Aug-05-2017, 06:32 PM
Last Post: vasilysmyslov

Forum Jump:

User Panel Messages

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