Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
18 lines (12 loc) · 242 Bytes

File metadata and controls

18 lines (12 loc) · 242 Bytes
Copy raw file
Download raw file
Edit and raw actions
@author jackzhenguo
@desc 
@date 2019/3/23

58 operator使用举例

from operator import (add, sub)


def add_or_sub(a, b, oper):
    return (add if oper == '+' else sub)(a, b)


add_or_sub(1, 2, '-')  # -1
Morty Proxy This is a proxified and sanitized view of the page, visit original site.