Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common errors and execution methods of python programs

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "common errors and execution methods of python programs". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the common errors and execution methods of python programs.

Common errors:

1 > hand error

2 > write multiple print on one line

Each line of code is responsible for completing an action

3 > indent error

Python is a programming language with strict format.

4 > python 2.x does not support Chinese by default

Python2.x interpreter python

Python3.x interpreter python3 (Chinese supported)

Introduction of Python versions 2.x and 3.x

Python2.x is the past version, and Python3.x is the mainstream version now and in the future.

Python3.x was not designed with backward compatibility in mind

The excessive version provided by Python2.6 basically uses the syntax and library of Python2.x, and takes into account the migration to Python3.0, allowing the use of some Python3.0 syntax and functions.

The Python2.7 launched in mid-2010 was identified as the last version of Python2.x.

If Python3.x cannot be used immediately during development (there are very few third-party libraries that do not support 3.0syntax), it is recommended to develop with the Python3.0 version first, then use Python2.7 to execute it, and do some compatibility processing.

Three ways to execute Python programs

1. Interpreter: python/python3 runs python programs interactively

Advantages

Suitable for learning / verifying python syntax or local code

Shortcoming

The code cannot be saved

It is not suitable to run programs that are too large

Exit the interpreter

Exit ()

Shortcut key ctrl-D

2. Ipython interpreter

IPython is an interactive shell for python, which is much easier to use than the default python shell

Support for automatic completion

Automatic indent

Support for bash shell commands

There are many useful functions and functions built in.

IPython is open source based on BSD.

Version: ipython/ipython3

3. IDE-pycharm of python

At this point, I believe that you have a deeper understanding of the "common errors and execution methods of python programs". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report