I have been developing a capitalizer in Python. This is actually a script that an end user will type at their terminal/command prompt. I have made this script to:
- Taking the first argument as a file name and process it.
- Don't process words that have 3 or less alphabet.
Here's some code:
#!/usr/bin/env python #-*- coding:utf-8 -*- from os import linesep from string import punctuation from sys import argv script, givenfile = argv with open(givenfile) as file: # List to store the capitalised lines. lines =  for line in file: # Split words by spaces. words = line.split() for i, word in enumerate(words): if len(word.strip(punctuation)) > 3: # Capitalise and replace words longer than 3 letters (counts # without punctuation). if word != word.upper(): words[i] = word.capitalize() # Join the capitalised words with spaces. lines.append(' '.join(words)) # Join the capitalised lines by the line separator. capitalised = linesep.join(lines) print(capitalised)
A lot more features still have to be added but this script does the stuff it is made for.
What I want (from you):
I want this script to be emerge as a command line utility. So,
- How can I make this a better command line utility?
- Could I have written in a better way?
- Can this script be faster?
- Are there any flaws?
- Other than GitHub, how can I make it available to the world (so that it is easier to install for end users)? because GitHub is for developers.
Please also post links to make my script and me even more mature.