Test string ops
This commit is contained in:
parent
71c0fe0fad
commit
1d49cde01d
17
main.py
17
main.py
@ -1,10 +1,9 @@
|
||||
#String tests
|
||||
a = "hello world"
|
||||
#[lw_inc:up_exc]
|
||||
print(a[2:8])
|
||||
print(a[:8])
|
||||
print(a[2:])
|
||||
#From the end
|
||||
print(a[-8:-2])
|
||||
print(a[-8:])
|
||||
print(a[:-2])
|
||||
a = " !Hello World! "
|
||||
print(a.upper())
|
||||
print(a.lower())
|
||||
print(a.strip())
|
||||
#strip(str_of_targ)
|
||||
print(a.strip((" !")))
|
||||
print(a.replace("H", "J"))
|
||||
print(a.split(" "))
|
||||
|
Loading…
Reference in New Issue
Block a user