The difference between Python3 and previous versions

Source: Internet
Author: User

The difference between Python3.0 and previous versions

(1) Print. The 3.1 version is enclosed in parentheses (print ("abs"), similar to Java) and version 2.0 is not used.

(2) input replaces the 2.0 version of Raw_input;

(3) version 3.0 does not have a file function, to open the document to use OPEN;F = open (Shoplistfile, ' WB ');

(4) without the Cpickle module, use the Pickle module;

(5) When using the Pickle.dump () method, the read operation of the Open file is "WB", when using the Load method, if the file is "RB",

(f = open (Shoplistfile, ' WB '); f = open (Shoplistfile, ' RB '); Shoplistfile is filename)

Otherwise there will be an error:

Traceback (most recent):

File "d:/pycharmprojects/project1/pythonsrcfile/schoolmember.py", line +, in <module>
Pickle.dump (SHOPLIST,F)
Typeerror:must is str, not bytes

The difference between Python3 and previous versions

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.