|
%, { }
|
|
str_format1 = “%d %x %c” %( 51, “Test”, “J” )
str_fromat2 = “{1} {2} {3}” . format(51, “Test”, “J”)
str_format3 = “{firstname} {lastname} {age}”.format(age=51, firstname=”Test”, lastname=”J” )
age = 51
firstname = “Test” lastname = “Jeong” str_format3 = f”{firstnamt} {lastname} {age -1}” |
|
print(f”{‘ name ‘:=^20}”)
======= name =======
|
| k_ssn = “710711-1234567” |
|
print( “Year “, k_ssn[ :2 ] ) # 71
print( “Month “, k_ssn[ 2:4 ] ) # 07 print( “Day “, k_ssn[ 4:6 ] ) #11print( “Gender “, k_ssn[ 7 ] ) # 1 print( “Number “, k_ssn[ 7: ] ) # 1234567 print( “Gender “, k_ssn[ -7: ] ) # 1234567 k_ssn[ : :2 ]
k_ssn[::-1]
\n : next line
\r : print the corsor in front \b : backspace \t : tab \” : ” \’ : ‘ \\ : \ str( 123 ) str.lower(), str.islower()
str.upper(), str[0].isupper() len(str) x = str.count(‘b’)
str.replace(“source”, “dest”)index = str.index(“a”)
index = str.index(“a”, index + 1) index = str.find(“abc”) str = “, “.join(‘abcd’)
a, b, c, d
str.lstrip()
str.lstrip()
str.strip()
str.split(“,”)
$reference_num = (dt[col_name][i]).replace(“10′, “”).replace(“1”, “”)
$reference_num = reference_num.rjust(12, ‘0’) |
| dIsplay the string 10 times |
|
print(“=” * 100)
|