Logicalwebhost Cheatsheet

Linux & Open Source Cheatsheets & Howto's

Skip to: Content | Sidebar | Footer

Category: python

Python basics

13 January, 2011 (16:23) | python | By: unclecameron

Examples run at the command line after typing “python” then getting the >>> prompt lists make a list and then do stuff with the data in it [codesyntax lang=”python”] >>> a = [66.25, 333, 333, 1, 1234.5] >>> print a.count(333), a.count(66.25), a.count(‘x’) 2 1 0 >>> a.insert(2, -1) >>> a.append(333) >>> a [66.25, 333, -1, […]