小编ACi*_*AiN的帖子

Python TypeError:强制转换为Unicode:需要字符串或缓冲区,找到元组

#!/usr/bin/env python
import sys
import os

print "Scan a file for ""ErrorScatter"" payload"
print "Drag the suspicious file here then press enter."
filepath = raw_input("File Location: ")
fixpath = filepath , "/Contents/MacOS/ErrorScatter"
scan = os.path.exists(fixpath)
Run Code Online (Sandbox Code Playgroud)

所以我正在制作一个程序来检查文件是否有"ErrorScatter"有效负载,但是在测试我的创建时我一直遇到并出错.因为我是新手,我不知道如何解决这个问题.

这是我得到的错误:

TypeError: coercing to Unicode: need string or buffer, tuple found
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这个问题?

python operating-system tuples typeerror

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

ItemArray.checklist.add()没有将字符串附加到ArrayList

我已经学习了大约3天的java,但我似乎无法将数据附加到我的ArrayLists之一(清单).尝试显示数组中的所有项时的输出始终为[].帮助会得到极大的赞赏!

ShopAssist.java:

import java.io.*;
import java.util.Scanner;

    class ShopAssist {
        public static void main(String[] args){
            //Items itemchecklist = new Items();
            System.out.println("( Add | Remove | Show | Exit )");
            System.out.print(">");
            Scanner menuinput = new Scanner(System.in);
            String choice = menuinput.nextLine();
            if (choice.equals("Add")){
                AddItem();
            }

            else if (choice.equals("Remove")){
                RemoveItem();
            }
            else if (choice.equals("Show")){
                ShowItems();
            }

        while(true){
            main(null);
        }
        }

        public static void AddItem(){
            Items ItemArray = new Items();
            System.out.print("Add: ");
            Scanner addinput = new Scanner(System.in);
            String addchoice = addinput.nextLine();
            ItemArray.checklist.add(addchoice);
            System.out.println("Info: " + …
Run Code Online (Sandbox Code Playgroud)

java arraylist

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

标签 统计

arraylist ×1

java ×1

operating-system ×1

python ×1

tuples ×1

typeerror ×1