0

I have a text file in that

line="File Creation Time:    2017-01-30T10:04:54.295767-08:00"

I have to split it with as a key and value pairs.
Below is my code:

 l = line.split(':', 1)

but I want to do it using regex operators.

Lafexlos
  • 7,618
  • 5
  • 38
  • 53
venkatesh
  • 21
  • 5
  • This looks close to what you're looking for, http://stackoverflow.com/questions/35609922/how-can-i-split-a-string-at-the-first-occurrence-of-a-letter-in-python – visc Feb 13 '17 at 06:31
  • but I read `split` or `partition` are the best solution for this – visc Feb 13 '17 at 06:33
  • Any try on regexp part? Because this seems like `write teh regex` for me. Also, why do you _need_ regexp specifically? Does `split` not satisfy your needs? – Lafexlos Feb 13 '17 at 08:08

0 Answers0