0
votes

While coding on python I faced a problem with importing modules using PIP. The thing is that I can not import a single module, for example "camelcase". Would someone help me?

import camelcase

c = camelcase.CamelCase()
txt = "hello world"
print(c.hump(txt))

It is expected that the output will be "Hello World". But there is following an error:

Traceback (most recent call last): File "mycode.py", line 1, in import camelcase ModuleNotFoundError: No module named 'camelcase'

1
Did you actually install this? How? - Daniel Roseman
you need to install the package pypi.org/project/camelcase via pip install camelcase - Devesh Kumar Singh

1 Answers

1
votes

ModuleNotFoundError: No module named 'camelcase'.Error clearly said that you need to install camelcase package

official docs of camelcase package

virtual env set up

Use the following command:

pip install camelcase

import camelcase  
c = camelcase.CamelCase()   
txt = "hello world"   
print(c.hump(txt))

Instead of third party package you can also do

print(txt.title())