The current implementation keeps an array of integer objects for all integers between -5 and 256, when you create an int in that range you actually just get back a reference to the existing object. So it should be possible to change the value of 1. I suspect the behaviour of Python in this case is undefined. :-)
In [1]: with open('/tmp/1', 'w+', encoding='cp1251') as f: f.write('qwertyйцукен')
In [2]: cat /tmp/1
qwerty������
In [3]: with open('/tmp/1', 'r', encoding='cp1251') as f: print(f.read())
qwertyйцукен
In [4]: with open('/tmp/1', 'r', encoding='cp1251') as f:
...: with open('/tmp/2', 'w+', encoding='utf-8') as o: o.write(str(f.read()))
...:
In [5]: cat /tmp/2
qwertyйцукен
mkdir temp
cd temp
git clone https://github.com/python/cpython.git
./configure --prefix=$HOME/bin/python
make
make install
# удалить симлинк python3 на python3.6
rm /home/$USERNAME/bin/python/bin/python3
export PATH=$PATH:/home/$USERNAME/bin/python/bin
python3.6 -V
> Python 3.6.0a3+
# справка по созданию виртуального окружения
python3.6 -m venv -h
sql = 'UPDATE base SET money=? WHERE nickname LIKE ?', (money, username)
cursor.execute(*sql)
# OR
sql = 'UPDATE base SET money=? WHERE nickname LIKE ?'
data = (money, username)
cursor.execute(sql, data)
r = requests.get(url)
with open(result_file_path, "wb") as f:
f.write(r.content)
r = requests.post('http://httpbin.org/post', data = {'key':'value'})