Skip to content

Instantly share code, notes, and snippets.

@SkyLeite
Created August 9, 2016 20:56
Show Gist options
  • Select an option

  • Save SkyLeite/ba4a30c598a7eb124df55b76e1d3998f to your computer and use it in GitHub Desktop.

Select an option

Save SkyLeite/ba4a30c598a7eb124df55b76e1d3998f to your computer and use it in GitHub Desktop.
import re
string = 'Ship01: Shironia\nShip02: Vopar\nShip03: -\nShip04: -\nShip05: -\nShip06: -\nShip07: Vopar\nShip08: -\nShip09: Amduscia\nShip10: -\n'.splitlines()
test = re.compile('(?:Ship\d\d):\s([^-]*)')
for line in string:
t = test.match(line)
#print(line)
if t.group(1) is not '':
print(t.group(1))
else:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment