@zed1/

Show that unicode regex won't work with bytes-like input

Python 2.7

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.006055144709102844","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMgoiIiLQodC+0YXRgNCw0L3Rj9GPINCyINGE0LDQudC7LCDQtNC+0LHQsNCy0YzRgtC1INCy0YLQvtGA0L7QuSDRgdGC0YDQvtC60L7QuTogIyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KCmh0dHBzOi8vcnUuc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzY5OTg0MC8lRDAlQTAlRDElODMlRDElODElRDElODElRDAlQkElRDAlQjglRDAlQjUtJUQxJTgxJUQwJUI4JUQwJUJDJUQwJUIyJUQwJUJFJUQwJUJCJUQxJThCLSVEMCVCMi0lRDElODAlRDAlQjUlRDAlQjMlRDElODMlRDAlQkIlRDElOEYlRDElODAlRDAlQkQlRDElOEIlRDElODUtJUQwJUIyJUQxJThCJUQxJTgwJUQwJUIwJUQwJUI2JUQwJUI1JUQwJUJEJUQwJUI4JUQxJThGJUQxJTg1LXB5dGhvbi82OTk4NjcjNjk5ODY3CiIiIgppbXBvcnQgcmUKCnByaW50IHJlLnN1Yih1J9CxJywgJycsICfQsNCx0LHQsCcpICNYWFggRE9FU04nVCBXT1JLCiMgLT4g0LDQsdCx0LAKcHJpbnQgcmUuc3ViKHUn0LEnLCAnJywgdSfQsNCx0LHQsCcpCiMgLT4g0LDQsA=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env python2
"""Сохраняя в файл, добавьте второй строкой: # -*- coding: utf-8 -*-

https://ru.stackoverflow.com/questions/699840/%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B5-%D1%81%D0%B8%D0%BC%D0%B2%D0%BE%D0%BB%D1%8B-%D0%B2-%D1%80%D0%B5%D0%B3%D1%83%D0%BB%D1%8F%D1%80%D0%BD%D1%8B%D1%85-%D0%B2%D1%8B%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F%D1%85-python/699867#699867
"""
import re

print re.sub(u'б', '', 'абба') #XXX DOESN'T WORK
# -> абба
print re.sub(u'б', '', u'абба')
# -> аа