Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
86 views
in Technique[技术] by (71.8m points)

python - quickly try line of code and work with variables in visual studio code

I am more used to Spyder and very new in vsc. In Spyder you have a python console where you can quickly try a codesnipped like:

print(len(a))

without having to run the entire code. Is that also possible in vsc? I have not seen anything.

In addition, I can only see the variables in the debug mode. In Spyder I have all variables after one run at hand and can try and experiment on the fly with them. Is there another Variable-viewer plugin or how could that be enabled?

question from:https://stackoverflow.com/questions/65901071/quickly-try-line-of-code-and-work-with-variables-in-visual-studio-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can use this extensions of python. It has a Jupyter Notebook feature that comes with a variable explorer. It is recommended to also add the Jupyter extension as well (they work together just fine), you can find it here.

You can read this documentary about how to use Jupyter with visual studio code, you can see that it shows how to display the variables the way you wanted.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...