Skip to content

Instantly share code, notes, and snippets.

@ejmurray
Created July 24, 2015 15:02
Show Gist options
  • Save ejmurray/6ed749906074692334c5 to your computer and use it in GitHub Desktop.
Save ejmurray/6ed749906074692334c5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""
This script takes a list of authors which have the following format:
[T Yamamoto, N Hagima, M Fukasawa, J Yamaguchi, M Nakamura, Y Kohno, K Nagata, Y Yamazoe.] or
[TS Emudianughe, J Caldwell, RL Smith.]
and converts it to the following format:
[Yamamoto T, Hagima N, Fukasawa M, Yamaguchi J, Nakamura M, Kohno Y, Nagata K, Yamazoe Y.] or
[Emudianughe TS , Caldwell J, Smith RL.]
"""
__author__ = 'Ernest'
import re
def swap_initials_surname(authors):
'''
split the list of authors and then split the initials and surname.
:param authors:
:return:
'''
'''
:param authors:
:return:
'''
updated_authors = []
for i in authors:
new = i.split(' ')
updated_authors.append(new)
return updated_authors
def swap(initial_surname):
return 0
b = swap_initials_surname(['TS Emudianughe', 'J Caldwell', 'RL Smith'])
print b
a = swap_initials_surname(['T Yamamoto', 'N Hagima', 'M Fukasawa', 'J Yamaguchi', 'M Nakamura', 'Y Kohno', 'K Nagata', 'Y Yamazoe'])
print a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment