Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Push value to dict of vectors

Rust

#![allow(unused)]
fn main() {
let mut map: HashMap<u64, Vec<u64>> = HashMap::new();
map.entry(50).or_default().push(10);
}

Python

map = {}
map.setdefault(50, []).append(10);