>>> a = 1
# What's the difference between the following operations?
In [1]: print a
In [2]: a
While the outlook values look preety much the same, there is a difference. The print statements use the "unofficial" string representation, while the bare value variable names use the "official" string representation.
>>> import datetime
>>> t = datetime.datetime.now()
In [1]: print t
In [2]: t
- class DoubleRep(object):
- def __str__(self):
- return "Hi, I'm a __str__"
- def __repr__(self):
- return "Hi, I'm a __repr__"
The standard Python prompt is >>>, whereas the IPython prompt consists of the word "In," followed by a number in brackets, floowed by a colon.
In [3]: print In In [4]: print Out
In [5]: type(In) In [6]: type(Out)
In is an IPython input list object and Out is a dict object. They, respectively, hold the input that you typed in and the output that none-None statements and expressions evaluated to.
>>> import rlcompleter, readline
>>> readline.parse_and_bind('tab: complete')
>>> import os
>>> os.list<TAB>
>>> os.ls<TAB><TAB>
.ipython/ipy_user_conf.py
In [1]: lsmagic In [2]: %<TAB> In [3]: %page ?
In [1]: alias nss netstat -lptn
In [1]: user = 'marr' In [2]: process = 'bash' In [3]: !ps aux | grep $user | grep $process In [4]: l = !ps aux | grep $user | grep $process
kind: ConfigMap apiVersion: v1 metadata:
name: elasticsearch-config-csc
- data:
- elasticsearch.yml: |
- cluster.name: "docker-cluster" network.host: 0.0.0.0 xpack.license.self_generated.type: trial xpack.monitoring.collection.enabled: true
kind: Deployment apiVersion: apps/v1 metadata:
name: csc-elasticsearch
- spec:
replicas: 1 selector:
- matchLabels:
- app: csc-elasticsearch
- template:
- metadata:
- labels:
- app: csc-elasticsearch
- spec:
- volumes:
name: config configMap:
name: elasticsearch-config-csc defaultMode: 420
- initContainers:
name: increase-vm-max-map image: busybox command:
- sysctl
- '-w'
- vm.max_map_count=262144
- securityContext:
privileged: true
- containers:
name: csc-elasticsearch image: 'docker.elastic.co/elasticsearch/elasticsearch:7.15.2' ports:
- containerPort: 9200 protocol: TCP
- containerPort: 9300 protocol: TCP
- env:
- name: ES_JAVA_OPTS value: '-Xms512m -Xmx512m'
- name: discovery.type value: single-node
- volumeMounts:
- name: config mountPath: /usr/share/elasticsearch/config/elasticsearch.yml subPath: elasticsearch.yml
kind: Service apiVersion: v1 metadata:
name: csc-elasticsearch
- spec:
- ports:
- name: csc-elasticsearch protocol: TCP port: 80 targetPort: 9200
- selector:
- app: csc-elasticsearch
type: ClusterIP sessionAffinity: None