Home > Backend Development > Python Tutorial > Python's ternary operator skills

Python's ternary operator skills

巴扎黑
Release: 2016-11-26 11:24:46
Original
1307 people have browsed it

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template