Issue
This is so weird... Code completion only works outside a method... Anyone know how to fix this?
src="https://i.stack.imgur.com/WFJPq.png" alt="enter image description here" />
Solution
This is the way it should work, and it has nothing to do with being inside or outside a method or function.
Your function does not have type hints (type annotations generally speaking), so Pycharm's type checker can't infer the type of text, and it assigns the Any type to texts.
Instead, if you put a type hint like text: str, then texts will be treated like a List[str]:
and Pycharm's autocomplete will show its methods:
Answered By - Jonathan Ciapetti Answer Checked By - Mildred Charles (Python.Easybugfix Admin)




Post a Comment
Post a Comment