小编pac*_*hvo的帖子

在Python 3中删除BMP(表情符号)之外的字符

我有一个错误: UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 266-266: Non-BMP character not supported in Tk

我正在解析数据,然后将一些表情符号分解为数组。data = 'this variable contains some emoji's?'我想要:data = 'this variable contains some emoji's'

如何从数据中删除这些字符或在Python 3中处理这种情况?

python python-3.x

2
推荐指数
1
解决办法
2336
查看次数

使用参数'()'和未找到关键字参数'{}'来反转'home'.尝试过0种模式:[]

我的项目名称是'trydjango19',我有两个应用程序:'newsletter'和'posts'.

trydjango19/urls.py是:

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^posts/', include("posts.urls", namespace='posts')),
    url(r'^', include("newsletter.urls", namespace='newsletter')),]
Run Code Online (Sandbox Code Playgroud)

newsletter/urls.py是:

urlpatterns = [
    url(r'^', 'newsletter.views.home', name='home'),]
Run Code Online (Sandbox Code Playgroud)

newsletter/view.py是:

def home(request):
    title = '???????? ??????'
    form = SignUpForm(request.POST or None)
    context = {
        "title": title,
        "form": form
    }
    if form.is_valid():
        instance = form.save(commit=False)

        full_name = form.cleaned_data.get("full_name")
        if not full_name:
            full_name = "anonymous"
        instance.full_name = full_name
        instance.save()
        context = {
            "title": "???? ?????? ???????!"
    }

    if request.user.is_authenticated() and request.user.is_staff:
        queryset = SignUp.objects.all().order_by('-timestamp') 
        context = {
            "queryset": queryset
        }

    return …
Run Code Online (Sandbox Code Playgroud)

python django django-urls django-views

1
推荐指数
1
解决办法
4244
查看次数

标签 统计

python ×2

django ×1

django-urls ×1

django-views ×1

python-3.x ×1