Problems that beginners often encounter when learning python.

Source: Internet
Author: User

Problems that beginners often encounter when learning python.

1. python2 or python3?

New users often think about this for a long time. The syntaxes of 2 and 3 are roughly the same, but the changes are not significant. For example, print xxx in python2, and print (xxx) is used in python3 ), however, in the current situation, python3 will be the mainstream in the future, and the update speed of python3 on the official website will be faster than that of python2, so you can directly learn python3

2. Input python in the command line to display non-internal or external commands?

It must be the path that is not added to python.exe in the environment variable. Add the path to it.

3. Want to switch between python2 and python3?

You can change python.exeto python2.exeand python3.exe, and enter python2 or python3 in the command line. Remember to add the path to the environment variable (as described in section 2)

4. error?

This is really a big problem for new users. Especially those who do not have any programming experience, how can they solve it? Generally, the first line and the last line show the location of the error, and the last line shows the cause and type of the error. The Center is a function call error, for example:

 

A = 1/0

F: \ python3 \ python.exe C:/Users/Administrator/PycharmProjects/testApp/tyr. py
Traceback (most recent call last ):
File "C:/Users/Administrator/PycharmProjects/testApp/tyr. py", line 1, in <module>
A = 1/0
ZeroDivisionError: division by zero

This tells us that the error is in the first line, which is ZeroDivisionError (Division: 0). If there is no error, but you cannot get the expected result, it is a logical error, check the code.

5. IDLE or?

The selection of the compiling environment is very important. I personally suggest using pycharm, which has the Lenovo function, which can save a lot of trouble, but the method of use should be Baidu.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.