Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
python [2016/07/29 19:41] nikolaj |
python [2017/06/12 17:04] nikolaj |
||
---|---|---|---|
Line 9: | Line 9: | ||
>any | >any | ||
>all | >all | ||
+ | |||
+ | >reversed(seq) | ||
+ | |||
+ | >mydict = dict(mykey1 = 3 | ||
+ | > ,mykey2 = 'hi' | ||
+ | > ) | ||
+ | |||
+ | >isinstance(3, int) | ||
+ | >isinstance('3', int) | ||
+ | >callableI(f) | ||
+ | >iter(o) | ||
>input() | >input() | ||
- | >callable | + | == Terminal args == |
+ | <code/Python> | ||
+ | from sys import argv as arguments | ||
+ | |||
+ | |||
+ | def get(): | ||
+ | return [(i, v) for i, v in enumerate(arguments)] | ||
+ | # Add if i > 0 if you want to neglect the .py | ||
+ | |||
+ | |||
+ | def main(): | ||
+ | print("\nHere is what main returns in pretty-print:") | ||
+ | for index, arg in get(): | ||
+ | print(index, arg) | ||
+ | |||
+ | |||
+ | if __name__ == '__main__': | ||
+ | main() | ||
+ | </code> | ||
=== Discussion === | === Discussion === | ||
Line 20: | Line 49: | ||
== Python.org == | == Python.org == | ||
- | [[https://docs.python.org/2/library/index.html | The Python Standard Library]], | + | [[https://docs.python.org/2/library/index.html | The Python Standard Library]] |
- | [[https://docs.python.org/2/library/functions.html | Built-in Functions]] | + | |
== Code examples == | == Code examples == |