TypeError: 'str' does not support the buffer interface

后端 未结 7 966
南方客
南方客 2020-11-22 03:11
plaintext = input(\"Please enter the text you want to compress\")
filename = input(\"Please enter the desired filename\")
         


        
7条回答
  •  借酒劲吻你
    2020-11-22 03:54

    For Django in django.test.TestCase unit testing, I changed my Python2 syntax:

    def test_view(self):
        response = self.client.get(reverse('myview'))
        self.assertIn(str(self.obj.id), response.content)
        ...
    

    To use the Python3 .decode('utf8') syntax:

    def test_view(self):
        response = self.client.get(reverse('myview'))
        self.assertIn(str(self.obj.id), response.content.decode('utf8'))
        ...
    

提交回复
热议问题