In [1]: import importlib
In [2]: requests.__version__
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-2-37d800a179a9> in <module>
----> 1 requests.__version__
NameError: name 'requests' is not defined
In [3]: requests = importlib.import_module('requests')
In [4]: requests.__version__
Out[4]: '2.22.0'
import pickle
# An arbitrary collection of objects supported by pickle.
data = {
'a': [1, 2.0, 3, 4+6j],
'b': ("character string", b"byte string"),
'c': {None, True, False}
}
with open('data.txt', 'wb') as f:
# Pickle the 'data' dictionary using the highest protocol available.
pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
import pickle
with open('data.txt', 'rb') as f:
# The protocol version used is detected automatically, so we do not
# have to specify it.
data = pickle.load(f)
print(data)
# {'a': [1, 2.0, 3, (4+6j)], 'b': ('character string', b'byte string'), 'c': {None, True, False}}
import re
text1 = '@0'
text2 = '0'
print(text1, text1.startswith('@'))
print(text2, text2.startswith('@'))
print(text1, bool(re.match('^@', text1)))
print(text2, bool(re.match('^@', text2)))
print(text1, text1[:1] == '@')
print(text2, text2[:1] == '@')
# @0 True
# 0 False
# @0 True
# 0 False
# @0 True
# 0 False
Все программы и ос храниться на hdd