Skip to content

Instantly share code, notes, and snippets.

@sertdfyguhi
Created March 10, 2021 13:43
Show Gist options
  • Save sertdfyguhi/b96324d11e2eb491c45dd5c4542cc904 to your computer and use it in GitHub Desktop.
Save sertdfyguhi/b96324d11e2eb491c45dd5c4542cc904 to your computer and use it in GitHub Desktop.
programToCamelCaseAPieceOfText
path = input('File path: ')
with open(path, 'r') as f:
contents = f.read()
contents_list = contents.split(' ')
for index, word in enumerate(contents_list):
if index == 0:
contents_list[index] = word.lower()
continue
contents_list[index] = word.capitalize()
print(''.join(contents_list))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment