Backslash notation |
Hexadecimal character |
Description |
---|---|---|
a |
0x07 |
Bell or alert |
|
0x08 |
Backspace |
e |
0x1b |
Escape |
f |
0x0c |
Formfeed |
|
0x0a |
Newline |
|
0x0d |
Carriage return |
s |
0x20 |
Space |
|
0x09 |
Tab |
- To remove trailing and leading white spaces from a string, include a white space before the Welcome and a leading space after the Python:
message = " Welcome To Python "
message = message.strip()
- To get the length of a string, do the following:
ip_address = '10.0.1.1'
string_length = len(ip_address)
- To split a string and return the value in a list, do the following:
ips= "10.0.0.1,10.0.0.2"
ips_splitted = ips.split(',')
print ips_splitted[0]