I have usernames that are in this format RSmith. I can put them in all upercase or Title them to look like this, Rsmith, but I need RSmith.
current script:
import csv
app_csv = ('/tmp/lowerAccounts.csv')
app_csv_upper = ('/tmp/Identity_Accounts.csv')
in_app_csv = open(app_csv)
out_app_csv = open(app_csv_upper, 'w')
inreader = csv.reader(in_app_csv)
outwriter = csv.writer(out_app_csv)
for row in inreader:
outwriter.writerow(row)
row[0] = row[0].upper()
outwriter.writerow(row)
row[0] = row[0].title(row)
outwriter.writerow(row)
In general, you should capitalize the first word, all nouns, all verbs (even short ones, like is), all adjectives, and all proper nouns. That means you should lowercase articles, conjunctions, and prepositions—however, some style guides say to capitalize conjunctions and prepositions that are longer than five letters.
To use a keyboard shortcut to change between lowercase, UPPERCASE, and Capitalize Each Word, select the text and press SHIFT + F3 until the case you want is applied.
Since they were used to prefix names which are proper nouns in themselves, the derived surnames have two capital letters. e.g. FitzGerald, McDonald, MacIntyre, O Henry etc. However, this isn't a rule.
You can use basic string slicing:
s = 'rsmith'
s = s[:2].upper() + s[2:]
print(s)
Output:
RSmith
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With