Home > front end >  suggestion in visual studio code doesn't work in python define function
suggestion in visual studio code doesn't work in python define function

Time:05-24

I'm programming in python

example

I'm making a function in Python using Visual Studio Code but the suggestions don't include string methods like replace(), lower() and strip().

I don't know what is causing this issue and I tried every setting in Visual Studio Code. Can anyone tell me why it doesn't show the methods while other IDEs do?

CodePudding user response:

You could use text:str so that pylance knows text is String.

Your original code doesn't define the type of text. It can be any type. Naturally, pylance can't give advice.

enter image description here

  • Related