Python 3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.2.1
>>> xs = ' řetězec \n \t\n'
>>> xs
0: ' řetězec \n \t\n'
>>> xs.strip()
1: 'řetězec'
>>> xs.lstrip()
2: 'řetězec \n \t\n'
>>> xs.rstrip()
3: ' řetězec'
>>> xs = ' řetězec \n \t \a \n'
>>> xs
4: ' řetězec \n \t \x07 \n'
>>> xs.strip()
5: 'řetězec \n \t \x07'
>>> xs
6: ' řetězec \n \t \x07 \n'
>>> xs.split()
7: ['řetězec', '\x07']
>>> xs.split('zec')
8: [' řetě', ' \n \t \x07 \n']
>>> xs.split('\a')
9: [' řetězec \n \t ', ' \n']
>>> xs = 'ABCDEF'
>>> for znak in xs:
... print(znak)
A
B
C
D
E
F
>>> for znak in xs:
... print(znak, end='')
ABCDEF
>>> dir(xs)
10: ['__add__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getnewargs__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmod__',
'__rmul__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'capitalize',
'casefold',
'center',
'count',
'encode',
'endswith',
'expandtabs',
'find',
'format',
'format_map',
'index',
'isalnum',
'isalpha',
'isascii',
'isdecimal',
'isdigit',
'isidentifier',
'islower',
'isnumeric',
'isprintable',
'isspace',
'istitle',
'isupper',
'join',
'ljust',
'lower',
'lstrip',
'maketrans',
'partition',
'removeprefix',
'removesuffix',
'replace',
'rfind',
'rindex',
'rjust',
'rpartition',
'rsplit',
'rstrip',
'split',
'splitlines',
'startswith',
'strip',
'swapcase',
'title',
'translate',
'upper',
'zfill']
>>> it = iter(xs)
>>> dir(it)
11: ['__class__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__length_hint__',
'__lt__',
'__ne__',
'__new__',
'__next__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__setstate__',
'__sizeof__',
'__str__',
'__subclasshook__']
>>> next(it)
12: 'A'
>>> next(it)
13: 'B'
>>> next(it)
14: 'C'
>>> next(it)
15: 'D'
>>> next(it)
16: 'E'
>>> next(it)
17: 'F'
>>> next(it)
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
next(it)
~~~~^^^^
StopIteration
>>> it = iter(xs)
>>> next(it)
18: 'A'
>>> next(it)
19: 'B'
>>> for znak in it:
... print(znak)
C
D
E
F
>>> x, y = 'ABC', 333
>>> x
20: 'ABC'
>>> y
21: 333
>>> print(x, y)
ABC 333
>>> print(x, y, sep='')
ABC333
>>> print(x + ' ', y, sep='')
ABC 333
>>> print(x, ' ' + y, sep='')
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
print(x, ' ' + y, sep='')
~~~~^~~
TypeError: can only concatenate str (not "int") to str
>>> print(x, ' ', y, sep='')
ABC 333
>>> print(f'{x} {y}')
ABC 333
>>> print(f'{x}{y}')
ABC333
>>> print(f'{x} --> {y}')
ABC --> 333
>>> print(f'{2*x} --> {y}')
ABCABC --> 333
>>>