Home  >  Article  >  Backend Development  >  Python’s ternary operator skills

Python’s ternary operator skills

巴扎黑
巴扎黑Original
2016-11-26 11:24:461249browse

I just came into contact with Python. When I used Python to write a crawler today, I suddenly discovered that it does not have a ternary operator, so I thought of some of the previous ways of writing ruby ​​and javascript, which should be possible

1, a = b if true else c

2 , a = b || c

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn