Have you done these six points? No wonder your Python project can't run!


When writing python code, we often encounter a series of problems such as bugs flying in the sky, code can not run, or project structure is useless. However, it is difficult for us to find out which step caused these problems.

One of the reasons for these problems is that we have not developed good programming habits. Programming habits are like special effects in movies. The better the special effects of the movie, the better the viewing effect will be. Similarly, if we can develop good programming habits, our thinking will be clearer when we look for errors.

So, how can you develop your own programming habits? Learn the following six methods, and you will not be far from becoming a good Python programmer.

Method 1: Use project management tools

Regardless of whether the Python project is simple or not, we should use Git for version control. Most IDEs (integrated development environments) that support Python have built-in support for project management tools such as Git.

When we modify the code, it often happens that the program crashes after the modification, and the latest version is sometimes not as good as the previous version. And Git, it happens to be able to help us save the previous version in time. After using it, we don't need to constantly use "ctrl+z" to withdraw the code.

Method 2: Use Python's built-in functions

Both Python's built-in functions and standard library can handle common use cases without the need to redefine functions yourself.

However, Python developers who are just getting started are not familiar with the functions. So they often encounter such a problem-how can they know whether the content in the standard library covers their use cases without the need to remember the content? The easiest way is to bookmark the standard library index and built-in function overview page, and browse it immediately when you encounter "daily programming" problems. When we use these functions more frequently, we can naturally remember these functions.

Method 3: Use the correct module

Like built-in functions and standard libraries, the large collection of third-party modules in Python can also help us save a lot of manpower. Through PyPI's web front-end, we can trigger search terms for our problems, and we can easily find a solution that suits us.

Method 4: Use OOP

Object-oriented programming (OOP) bundles data structures with methods for manipulating them, making it easier to write high-level code. OOP is very suitable for high-level languages ​​like Python, especially when the project is very complex. Developers familiar with Python know that using OOP can reduce the amount of code and save a lot of time.

However, not all projects need to use OOP. If there are no special requirements for the project, some small projects may not need OOP.

Method five: write test code and continue to test

A good programmer must know the importance of testing to the project. Writing test code is indeed a very boring process, but without testing, we will not be able to find the problem of the program.

If a project is very complex, we must do timely testing. The sooner you test, the sooner you can find problems. Rather than waiting for the code to be written before starting the test, this will lead to more errors and greater workload.

Of course, we can also look for professional software testers to help us test. In this way, we can also devote more energy to the project itself.

Method 6: Choose the correct Python version

Some people are still using Python2, but the official Python development team has long stopped maintaining this version. Smart developers have migrated projects in Python2 to Python3.

The latest version of Python is Python3.8.5, but it does not mean that you must use the latest version. Professional software developers know that the latest version of any software is not necessarily the best, because it still requires continuous improvement by the development team. Programmers generally use a version before the latest version, and the old version is relatively mature.

No matter which language is used to write code, good programmers have good programming habits. These habits not only make our thinking clearer, but also help us reduce the workload, thereby saving a lot of time. So, maybe you are only one good habit from a good programmer~


Finally: a wave of software testing data sharing!

In the technology industry, you must improve your technical skills and enrich your practical experience in automation projects. This will be very helpful for your career planning in the next few years and the depth of your test technology mastery.

In the interview season of the Golden 9th and the Silver 10th, the season of job-hopping, organizing interview questions has become my habit for many years! The following is my collection and sorting in recent years, the whole is organized around [software testing], the main content includes: python automation test exclusive video, Python automation details, a full set of interview questions and other knowledge content.

May you and I meet and you will find something! If you want to exchange experience in software testing, interface testing, automated testing, and interviews. Follow WeChat public account:[Sad Spicy Strips]Receive a 216-page software test engineer interview book for free. And the corresponding video learning tutorials are free to share! Communication learning skirt:313782132

Recommend good articles:

Packaged as a test engineer with 1 year of work experience, my advice before the interview is as follows

What exactly should I learn in automated testing?

Why not consider Tencent for job-hopping? Talk about a little bit of the past between me and the goose factory

Which is more advanced, automated testing or manual testing?

Novice must see: How to write a qualified test case?

Python login interface test problem record and solution (dry goods)

Guess you like

Origin blog.csdn.net/weixin_50829653/article/details/114107668