---
title: "Python的三目运算符技巧"
author: "Horse_Chasing"
date: "2016-03-31T00:24:52Z"
tags: []
categories: ["编程语言"]
slug: "python"
draft: false
lastmod: "2016-09-11T21:51:15Z"
id: 2287653
url: "https://horse-chasing.iteye.com/blog/2287653"
---

刚刚接触Python，今天用Python写爬虫时，突然发现它没有三目运算符，于是联想到之前写ruby和javascript的一些方式，应该可以实现

1、a = b if true else c

2、a = b || c

所有博客已经转移至leanote：<http://blog.leanote.com/shiwei/>

或者：<http://luoshiwei.me/>