-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-string.py
executable file
·63 lines (49 loc) · 1.17 KB
/
test-string.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /usr/bin/python
# copied from http://www.python-izm.com/contents/introduction/syntax.shtml
print 'python-izm'
print "python-izm"
test_str = """
test_1
test_2
"""
print test_str
test_str2 = "python"
test_str2 = test_str2 + "-"
test_str2 = test_str2 + "izm"
print test_str2
test_str3 = "012"
test_str3 += "345"
test_str3 += "678"
test_str3 += "9"
print test_str3
test_integer = 100
print str(test_integer) + " yen"
test_str4 = "python-izm"
print test_str4.replace("izm", "ism")
test_str5 = "python-izm"
print test_str5.split("-")
test_str6 = "1234"
print test_str6.rjust(10, "0")
print test_str6.rjust(10, "!")
print test_str6.zfill(10)
print test_str6.zfill(3)
test_str7 = "python-izm"
print test_str7.startswith("python")
print test_str7.startswith("izm")
print "z" in test_str7
print "s" in test_str7
test_str8 = "PyThon-Izm"
print test_str8.upper()
print test_str8.lower()
test_str8 = " python-izm.com"
print test_str8
test_str8 = test_str8.lstrip()
print test_str8
test_str8 = test_str8.lstrip("python")
print test_str8
test_str9 = "python-izm.com "
print test_str9 + "/"
test_str9 = test_str9.rstrip()
print test_str9 + "/"
test_str9 = test_str9.rstrip("com")
print test_str9