以下のコードで、test関数内の"hogehoge"をstr型でtest_test関数に渡して、encodeしたいが、functionとして渡されているためできないようになっている。
どう対処すればよいのでしょうか?
flask
1def test(): 2 hoge = "hogehoge" 3 return hoge 4 5def test_test(): 6 h = test 7 import pdb; 8 pdb.set_trace() 9 print(h) 10 pass
pdb
1(Pdb) p h 2<function test at 0x104328400> 3(Pdb) p h.encode('UTF-8') 4*** AttributeError: 'function' object has no attribute 'decode' 5(Pdb) 6
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/06 02:35