-4

I have a list: [ "123-12 abc, qwerty", "pol, T. top", "14-89 toy, rap"].

I want to output it like this using Regular Expressions:

qwerty abc 123-12

T. top pol

rap toy 14-89

Is there any pythonic way to solve this? Thank you.

DYZ
  • 55,249
  • 10
  • 64
  • 93
JC7
  • 1
  • So, basically you want to reverse the words in a string? Why do you have to use regex for that? – shad0w_wa1k3r Apr 16 '17 at 05:44
  • 2
    First, it would help if you explained what exactly you want to do, instead of relying examples. Second, what did you attempt and why/how it did not work? Third, the title of your question is totally irrelevant to the question: you do not have a set, and you do not order it. – DYZ Apr 16 '17 at 05:44

1 Answers1

0

There is no need to use regular expression.Here is a simple solution

l = [ "123-12 abc, qwerty", "pol, T. top", "14-89 toy, rap"]
for i in l:
    t = i.split(",")
    print(t[1],t[0])
Kiran KN
  • 85
  • 1
  • 10