# https://stackoverflow.com/a/19053800/5415895
def to_camel_case(snake_str):
components = snake_str.split('_')
# We capitalize the first letter of each component except the first one
# with the 'title' method and join them together.
return components[0] + "".join(x.title() for x in components[1:])
def main():
with open('temp1.txt') as f:
f2 = open("temp2.txt", 'w')
data = f.readlines()
for d in data:
item = d.split(',')
for i in item:
# https://stackoverflow.com/a/899176/5415895
f2.write("%s\n" % to_camel_case(i))
if __name__ == "__main__":
main()
Comments