简体   繁体   中英

suggestion in visual studio code doesn't work in python define function

I'm programming in python

例子

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?

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.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM