Skip to content

Instantly share code, notes, and snippets.

@gsscoder
Last active November 9, 2019 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsscoder/a966a477ed747484a0545cba3fd5e379 to your computer and use it in GitHub Desktop.
Save gsscoder/a966a477ed747484a0545cba3fd5e379 to your computer and use it in GitHub Desktop.
Script to turn languages code into part of a regex
# file URL: https://raw.githubusercontent.com/gsscoder/test-data/master/language-codes-3b2.csv
buf = ''
with open('language-codes-3b2.csv') as csv:
data = csv.readlines()
for d in data[1:]:
langs = d.split(',')
buf += f'{langs[0].upper()}|{langs[1].upper()}|'
print(buf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment