2013-12-29 17:34:42 -05:00
|
|
|
# basic strings
|
|
|
|
|
|
|
|
x = 'abc'
|
|
|
|
print(x)
|
|
|
|
|
|
|
|
x += 'def'
|
|
|
|
print(x)
|
|
|
|
|
|
|
|
print('123' + "456")
|
2014-01-05 05:47:51 -05:00
|
|
|
|
2014-01-20 17:27:33 -05:00
|
|
|
print('123' * 5)
|
|
|
|
|
2014-01-20 19:22:02 -05:00
|
|
|
print('abc'[1])
|
|
|
|
print('abc'[-1])
|
|
|
|
try:
|
|
|
|
'abc'[100]
|
|
|
|
except IndexError:
|
|
|
|
print('caught')
|
|
|
|
try:
|
|
|
|
'abc'[-4]
|
|
|
|
except IndexError:
|
|
|
|
print('caught2')
|
|
|
|
|
2014-01-05 05:47:51 -05:00
|
|
|
# iter
|
|
|
|
print(list('str'))
|
2014-01-08 15:41:22 -05:00
|
|
|
|
|
|
|
print('123' + '789' == '123789')
|
|
|
|
print('a' + 'b' != 'a' + 'b ')
|
|
|
|
|
|
|
|
# Not implemented so far
|
|
|
|
# print('1' + '2' > '2')
|
|
|
|
# print('1' + '2' < '2')
|