Importing custom modules under Windows Python Import

Source: Internet
Author: User

Study this at home on weekends and find a solution.

Crap less, on the code

1 #define a custom function, as follows2 #the name of the function must be a combination of letters and numbers and cannot begin with a number3 #after the function name, enclose the arguments in parentheses, and you can separate multiple4 #If there is a return value with return, if there is no return value, the default return is None5 6 defPanduanfenshu (score):7     if>= Score >= 90:8         Print("A")9     if> Score >= 80:Ten         Print("B") One     if> Score >= 60: A         Print("C") -     if> Score >=0: -         Print("D") the     ifScore < 0orScore > 100: -         Print("Input Error") -  -  + defPANDUANFENSHU2 (score): -     if>= Score >= 90: +         return 'A' A     ifScore >= 80: at         return 'B' -     ifScore >= 60: -         return "C" -     if> Score >=0: -         return 'D' -     ifScore < 0orScore > 100: in         return 'Input Error'

Code at the time of invocation

1 #introducing a custom module2 ImportSYS3 4 #note the path string for the custom module has R before5Sys.path.append (R"D:\Users\Admin\Desktop\lianxi")6 7 #this sentence is necessary.8 ImportFenshu9 Ten #need to add file name and decimal point before calling OneFenshu. Panduanfenshu (9)

Importing custom modules under Windows Python Import

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.