用Python程序计算文件中的括号数量?

发布于 2024-08-14 15:40:11 字数 1137 浏览 14 评论 0原文

我想通过它修复一个函数我可以计算使用了多少次:(,),[,] 如果 ( 的计数等于 ) 的计数 如果 [ 的计数等于 ] 的计数 那么我就有了有效的语法!

我的第一次-失望-尝试:

filename=input("Give a file name:")

def  parenthesis(filename):
    try:
        f=open(filename,'r')
    except (IOError):
        print("The file",filename,"does not exist!False! Try again!")
    else:
         while True:
            for line in filename:
                line=f.readline()
                if line=='(':
                     c1=line.count('(')
                elif line==')':
                     c2=line.count(')')
                elif line=='[':
                     c3=line.count('[')
                elif line==']':
                     c4=line.count(']')
                elif line=='':
                    break

                if c1==c2:
                     print("Line: Valid Syntax")
                elif c1!=c2:
                     print("Line: InValid Syntax")
                elif c3==c4:
                     print("Line: Valid Syntax")
                elif c3!=c4:
                     print("Line: InValid Syntax")
    finally:
        f.close()

parenthesis(filename)

I Wanna fix a function through it i can count how many times are used the:(,),[,]
if the counts of ( are equal to those of )
and if the counts of [ are equal to those of ]
then i have valid syntax!

my first -dissapointed- try:

filename=input("Give a file name:")

def  parenthesis(filename):
    try:
        f=open(filename,'r')
    except (IOError):
        print("The file",filename,"does not exist!False! Try again!")
    else:
         while True:
            for line in filename:
                line=f.readline()
                if line=='(':
                     c1=line.count('(')
                elif line==')':
                     c2=line.count(')')
                elif line=='[':
                     c3=line.count('[')
                elif line==']':
                     c4=line.count(']')
                elif line=='':
                    break

                if c1==c2:
                     print("Line: Valid Syntax")
                elif c1!=c2:
                     print("Line: InValid Syntax")
                elif c3==c4:
                     print("Line: Valid Syntax")
                elif c3!=c4:
                     print("Line: InValid Syntax")
    finally:
        f.close()

parenthesis(filename)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

初与友歌 2024-08-21 15:40:12

你想确保他们括号 & 吗?大括号匹配吗? “[(])”失败了?如果不是,那么您的路径是正确的,只是您需要将“=”更改为“+=”。您正在丢弃前几行的值。

Do you want to ensure that they parens & braces are matched? That "[(])" fails? If not, you're along the right path, except that you need to change your "=" to "+=". You're discarding the values of previous lines.

时光是把杀猪刀 2024-08-21 15:40:12

所有这些答案都是错误的,并且不适用于所有情况,因此要么使用 python 解析器,例如 tokenize 等,要么只使用此

count = min(text.count("("), text.count(")"))

All of these answers are wrong and will not work in all cases, so either use python parser e.g. tokenize etc or just use this

count = min(text.count("("), text.count(")"))

遥远的绿洲 2024-08-21 15:40:12

我的解决方案将尝试帮助您了解更精确的方法,并希望您能在此过程中了解一些有关数据结构的知识。

为了正确做到这一点,你需要使用 堆栈。您需要提取 (、)、[ 和 ] 的所有实例(可能使用正则表达式...提示)并遍历生成的数组:

假设您的文件如下:

(this [is] foobar)

您的正则表达式将产生此数组:

['(', '[', ']', ')'] 

您将将此数组 pop(0) 放入堆栈中。

算法

1)将所有标签{(,),[,]}放入一个数组中。

2) 对于数组中的每个元素,从其中 pop(0) 并将其推入堆栈。对照之前的元素对其进行测试。如果它关闭它之前的元素,则从数组中 pop() 两次(例如,如果堆栈上有 '(',并且要压入堆栈的下一个元素是 ')',则 ')' 关闭 ' (',所以你将它们都弹出。)如果没有,请继续。

3)如果结束时你的数组是空的并且堆栈是空的,那么你的文件格式正确。如果不是,那么您的文件格式不正确{类似于 (foo[bar)] }。

奖励:正则表达式:REGEX = re.compile(r"\)\(\[\]"), REGEX.findall(要搜索的字符串)。在此处查看有关 Python 中正则表达式的更多信息。

My solution will try to help you understand a bit more precise way of doing this, and hopefully you'll learn a bit about data structures in the process.

To properly do this, you're going to want to use a stack. You'll want to pull out all instances of (, ), [, and ] (perhaps using a regular expression... hint) and go through the array that that generates:

Say your file is like this:

(this [is] foobar)

Your regular expression will yield this array:

['(', '[', ']', ')'] 

You will pop(0) off of this array into a stack.

Algorithmically:

1) Put all tags {(,),[,]} in an array.

2) For each element in the array, pop(0) from it and push it onto your stack. Test it against the element before it. If it closes the element before it, then pop() twice from the array (eg, if you have '(' on the stack, and the next element to be pushed onto the stack is a ')', ')' closes '(', so you pop them both.) If it doesn't, continue.

3) If your array is empty and your stack is empty when this is over, then your file is well formed. If it's not, then you have a poorly formed file {something like (foo[bar)] }.

Bonus: regular expression: REGEX = re.compile(r"\)\(\[\]"), REGEX.findall(your string to search). See more about regexes in Python here.

潜移默化 2024-08-21 15:40:11

请原谅此回复的长度。

如果我理解正确的话,你想做简单的语法
检查括号以确保它们正确平衡。
在您的问题中,您指定了一个基于简单计数的测试,但是
正如其他人指出的那样,这并没有捕获诸如
“([)]”。

我还想对其他方面提出一些建设性的批评
您的代码的各个方面。

首先,最好从命令中获取文件名
行,而不是提示它。这样您就可以轻松地
在开发时重复运行该程序,而无需
始终输入文件名。这是你的方式:

$ python foo.py
指定文件名:数据
[一些输出]
$ python foo.py
指定文件名:数据
[一些输出]
$ python foo.py
指定文件名:数据
[一些输出]

您每次都需要输入文件名。你不需要输入
在命令中多次运行该程序。第一个之后
此时,您可以使用箭头键从 shell 的命令中获取它
历史。如果你从命令行获取文件名,你可以这样做
这个:

$ python foo.py 测试文件
[一些输出]
$ python foo.py 测试文件
[一些输出]
$ python foo.py 测试文件
[一些输出]

这样,当你第二次测试时,你不需要再输入更多内容
比向上箭头和 Enter 键。这是一个小小的便利,但是
这很重要:当你开发软件时,即使是很小的软件
事情可能会开始变得烦人。就像你脚下有一粒大沙
长途步行时脚部:您一开始甚至不会注意到它
几公里,但再跑几公里后,你就会流血。

在 Python 中,要访问命令行参数,您需要
sys.argv 列表。对程序的相关更改:

import sys
filename = sys.argv[1]

如果您确实想要提示,则应该使用除
内置输入功能。它解释用户输入的任何内容
作为 Python 表达式,这会导致各种各样的问题。
您可以使用 sys.stdin.readline 进行读取。

无论如何,我们现在已经将文件名安全地存储在
filename 变量。是时候用它做点什么了。
您的括号函数几乎可以完成所有操作,并且
经验表明,这通常不是最好的方法
做事。每个函数应该只做一个
事,但要做好。

我建议你应该保留实际打开的部分
并关闭与实际计数分开的文件。这
将简化计数的逻辑,因为它不会
需要担心其余的事情。在代码中:

import sys

def check_parentheses(f):
    pass # we'll come to this later

def main():
    filename = sys.argv[1]
    try:
        f = file(filename)
    except IOError:
        sys.stderr.write('Error: Cannot open file %s' % filename)
        sys.exit(1)
    check_parentheses(f)
    f.close()

main()

除了重新排列之外,我还更改了其他一些内容
事物。首先,我将错误消息写入标准错误输出。
这是正确的做法,并且意味着更少的意外情况
用户重定向输出。 (如果这对你来说没有任何意义,
不用担心,暂时接受它作为给定的值即可。)

其次,如果出现错误,我会使用 sys.exit(1) 退出程序。
这告诉启动程序的人它失败了。在Unix中
shell,这可以让你做如下的事情:

if python foo.py inputfile
then
    echo "inputfile is OK!"
else
    echo "inputfile is BAD!"
fi

shell 脚本可能做一些比仅仅报告更有趣的事情
当然,成功或失败。例如,它可能会删除所有
损坏的文件,或者向编写这些文件的人发送电子邮件要求他们修复它们。
美妙之处在于,编写检查器程序的您不需要
去关心。您只需正确设置程序退出代码,然后让任何人
编写 shell 脚本来关心剩下的事情。

下一步是实际读取文件的内容。这
可以通过多种方式完成。最简单的方法就是逐行进行
像这样:

for line in f:
    # do something with the line

然后我们需要查看该行中的每个字符:

for line in f:
    for c in line:
        # do something with the character

我们现在准备好实际开始检查括号。按照建议
对于其他人来说,堆栈是适合此目的的数据结构。
堆栈基本上是一个列表(或数组),您可以在其中添加项目
结束,并按相反顺序取出。将其视为一堆
硬币:可以在顶部添加硬币,也可以删除最上面的硬币
硬币,但不能从中间或底部取出硬币。

(好吧,你可以,如果你这样做的话,这就是一个巧妙的技巧,但是计算机是
简单的野兽并被魔术弄得心烦意乱。)

我们将使用 Python 列表作为堆栈。要添加项目,我们使用
列表的 append 方法,并使用 pop 方法删除。
一个例子:

stack = list()
stack.append('(')
stack.append('[')
stack.pop() # this will return '['
stack.pop() # this will return '('

要查看堆栈中最顶层的项目,我们使用 stack[-1] (在
换句话说,列表中的最后一项)。

我们按如下方式使用堆栈:当我们找到左括号 ('('),
括号('['),或者大括号('{'),我们把它放在栈上。当我们
找到一个结束项,我们检查堆栈中最上面的一项,然后
确保它与最后一个匹配。如果没有,我们打印一个
错误。像这样:

def check_parentheses(f):
    stack = list()
    for line in f:
        for c in line:
            if c == '(' or c == '[' or c == '{':
                stack.append(c)
            elif c == ')':
                if stack[-1] != '(':
                    print 'Error: unmatched )'
                else:
                    stack.pop()
            elif c == ']':
                if stack[-1] != '[':
                    print 'Error: unmatched ]'
                else:
                    stack.pop()
            elif c == '}':
                if stack[-1] != '{':
                    print 'Error: unmatched }'
                else:
                    stack.pop()

现在确实找到了各种不匹配的括号。我们
可以通过报告行和列来稍微改进一下
我们在哪里找到问题。我们需要行号和列号
柜台。

def error(c, line_number, column_number):
    print 'Error: unmatched', c, 'line', line_number, 'column', column_number

def check_parentheses(f):
    stack = list()
    line_number = 0
    for line in f:
        line_number = line_number + 1
        column_number = 0
        for c in line:
            column_number = column_number + 1
            if c == '(' or c == '[' or c == '{':
                stack.append(c)
            elif c == ')':
                if stack[-1] != '(':
                    error(')', line_number, column_number)
                else:
                    stack.pop()
            elif c == ']':
                if stack[-1] != '[':
                    error(']', line_number, column_number)
                else:
                    stack.pop()
            elif c == '}':
                if stack[-1] != '{':
                    error('}', line_number, column_number)
                else:
                    stack.pop()

另请注意我如何添加辅助函数 error 来执行实际操作
打印错误消息。如果您想更改错误消息,
您现在只需在一处进行即可。

另外需要注意的是,办理结案的案件
符号都非常相似。我们也可以将其变成一个函数。

def check(stack, wanted, c, line_number, column_number):
    if stack[-1] != wanted:
        error(c, line_number, column_number)
    else:
        stack.pop()

def check_parentheses(f):
    stack = list()
    line_number = 0
    for line in f:
        line_number = line_number + 1
        column_number = 0
        for c in line:
            column_number = column_number + 1
            if c == '(' or c == '[' or c == '{':
                stack.append(c)
            elif c == ')':
                check(stack, '(', ')', line_number, column_number)
            elif c == ']':
                check(stack, '[', ']', line_number, column_number)
            elif c == '}':
                check(stack, '{', '}', line_number, column_number)

该程序可以进一步完善,但目前应该足够了。
我将在最后包含整个代码。

请注意,该程序只关心各种括号。
如果你真的想检查整个 Python 程序的语法
为了正确性,你需要解析所有 Python 的语法,并且
非常复杂,对于一个 Stack Overflow 答案来说太多了。
如果这就是您真正想要的,请提出后续问题。

整个程序:

import sys

def error(c, line_number, column_number):
    print 'Error: unmatched', c, 'line', line_number, 'column', column_number

def check(stack, wanted, c, line_number, column_number):
    if stack[-1] != wanted:
        error(c, line_number, column_number)
    else:
        stack.pop()

def check_parentheses(f):
    stack = list()
    line_number = 0
    for line in f:
        line_number = line_number + 1
        column_number = 0
        for c in line:
            column_number = column_number + 1
            if c == '(' or c == '[' or c == '{':
                stack.append(c)
            elif c == ')':
                check(stack, '(', ')', line_number, column_number)
            elif c == ']':
                check(stack, '[', ']', line_number, column_number)
            elif c == '}':
                check(stack, '{', '}', line_number, column_number)

def main():
    filename = sys.argv[1]
    try:
        f = file(filename)
    except IOError:
        sys.stderr.write('Error: Cannot open file %s' % filename)
        sys.exit(1)
    check_parentheses(f)
    f.close()

main()

Please excuse the length of this reply.

If I understand you correctly, you want to do simple syntax
checking of parentheses to make sure they are balanced correctly.
In your question you specify a test based on simple counting, but
as others have pointed out, this does not catch things like
"([)]".

I'd also like to offer some constructive criticism on other
aspects of your code.

To start with, it is better to get the filename from the command
line, and not to prompt for it. This is so that you can easily
run the program repeatedly, when developing it, without having
to type in the filename all the time. This is your way:

$ python foo.py
Give a file name:data
[some output]
$ python foo.py
Give a file name:data
[some output]
$ python foo.py
Give a file name:data
[some output]

You need to type in the filename every time. You don't need to type
in the command to run the program more than once. After the first
time, you can use the arrow key to get it from the shell's command
history. If you get the filename from the command line, you can do
this instead:

$ python foo.py testfile
[some output]
$ python foo.py testfile
[some output]
$ python foo.py testfile
[some output]

This way, when you test the second time, you don't need to type more
than the up arrow and Enter keys. This is a small convenience, but
it is important: when you're developing software, even small
things can start annoying. It's like a large grain of sand under your
foot when going on a long walk: you won't even notice it for the first
couple of kilometers, but after a few more, you're bleeding.

In Python, to access the command line arguments, you need the
sys.argv list. The relevant changes to your program:

import sys
filename = sys.argv[1]

If you do want to prompt, you should use something else than the
built-in input function. It interprets whatever the user types
as a Python expression, and that causes all sorts of problems.
You could read using sys.stdin.readline.

Anyway, we've now got the name of the file safely stored in
the filename variable. It's time to do something with it.
Your parentheses function does pretty much everything, and
experience has shown that that's often not the best way of
doing things. Every function should, instead, do just one
thing, but do that well.

I suggest that you should keep the parts of actually opening
and closing a file separate from the actual counting. This
will simplify the logic of the counting, since it does not
need to worry about the rest. In code:

import sys

def check_parentheses(f):
    pass # we'll come to this later

def main():
    filename = sys.argv[1]
    try:
        f = file(filename)
    except IOError:
        sys.stderr.write('Error: Cannot open file %s' % filename)
        sys.exit(1)
    check_parentheses(f)
    f.close()

main()

I changed a couple of other things, too, in addition to rearranging
things. First, I write the error message to the standard error output.
This is the proper way to do it, and means fewer surprises to shell
users to redirect the output. (If that doesn't make any sense to you,
don't worry about it, just accept it as a given for now.)

Second, if there's an error, I exit the program with sys.exit(1).
This tells whoever started the program that it failed. In Unix
shell, this lets you do things like the following:

if python foo.py inputfile
then
    echo "inputfile is OK!"
else
    echo "inputfile is BAD!"
fi

The shell script might do something more interesting than just reporting
success or failure, of course. It might, for example, remove all
broken files, or e-mail whoever wrote them to ask them to fix them.
The beauty is that you, who write the checker program, do not need
to care. You just set the program exit code properly, and let whoever
writes the shell script to worry about the rest.

The next step is to actually read the contents of the file. This
can be done in various ways. The easiest way is to do it line-by-line,
like this:

for line in f:
    # do something with the line

We then need to look at each character in the line:

for line in f:
    for c in line:
        # do something with the character

We're now ready to actually start checking parentheses. As suggested
by others, a stack is the appropriate data structure for this.
A stack is basically a list (or array) where you add items to one
end, and take them out in reverse order. Think of it as a stack of
coins: you can add a coin to the top, and you can remove the topmost
coin, but you can't remove one from the middle or bottom.

(Well, you can, and it's a neat trick if you do, but computers are
simple beasts and get upset by magic tricks.)

We will use a Python list as a stack. To add an item, we use
the list's append method, and to remove we use the pop method.
An example:

stack = list()
stack.append('(')
stack.append('[')
stack.pop() # this will return '['
stack.pop() # this will return '('

To look at the topmost item in the stack, we use stack[-1] (in
other words, the last item in the list).

We use the stack as follows: when we find an opening parentheses ('('),
bracket ('['), or brace ('{'), we put it on the stack. When we
find a closing one, we check the topmost item on the stack, and
make sure that it matches the closing one. If not, we print an
error. Like this:

def check_parentheses(f):
    stack = list()
    for line in f:
        for c in line:
            if c == '(' or c == '[' or c == '{':
                stack.append(c)
            elif c == ')':
                if stack[-1] != '(':
                    print 'Error: unmatched )'
                else:
                    stack.pop()
            elif c == ']':
                if stack[-1] != '[':
                    print 'Error: unmatched ]'
                else:
                    stack.pop()
            elif c == '}':
                if stack[-1] != '{':
                    print 'Error: unmatched }'
                else:
                    stack.pop()

This now does find unmatched parentheses of various kinds. We
can improve it a little bit by reporting the line and column
where we find the problem. We need a line number and column number
counter.

def error(c, line_number, column_number):
    print 'Error: unmatched', c, 'line', line_number, 'column', column_number

def check_parentheses(f):
    stack = list()
    line_number = 0
    for line in f:
        line_number = line_number + 1
        column_number = 0
        for c in line:
            column_number = column_number + 1
            if c == '(' or c == '[' or c == '{':
                stack.append(c)
            elif c == ')':
                if stack[-1] != '(':
                    error(')', line_number, column_number)
                else:
                    stack.pop()
            elif c == ']':
                if stack[-1] != '[':
                    error(']', line_number, column_number)
                else:
                    stack.pop()
            elif c == '}':
                if stack[-1] != '{':
                    error('}', line_number, column_number)
                else:
                    stack.pop()

Note also how I added a helper function, error, to do the actual
printing of the error message. If you want to change the error message,
you now only need to do it in one place.

Another thing to notice is that the cases for handling the closing
symbols are all very similar. We could make that to a function, too.

def check(stack, wanted, c, line_number, column_number):
    if stack[-1] != wanted:
        error(c, line_number, column_number)
    else:
        stack.pop()

def check_parentheses(f):
    stack = list()
    line_number = 0
    for line in f:
        line_number = line_number + 1
        column_number = 0
        for c in line:
            column_number = column_number + 1
            if c == '(' or c == '[' or c == '{':
                stack.append(c)
            elif c == ')':
                check(stack, '(', ')', line_number, column_number)
            elif c == ']':
                check(stack, '[', ']', line_number, column_number)
            elif c == '}':
                check(stack, '{', '}', line_number, column_number)

The program can be refined further, but this should suffice for now.
I'll include the whole code at the end.

Note that this program only cares about parentheses of various kinds.
If you really want to check a whole Python program for syntactic
correctness, you'll need to parse all of Python's syntax, and that
is pretty complicated, and too much for one Stack Overflow answer.
If that's what you really do want, please ask a followup question.

The whole program:

import sys

def error(c, line_number, column_number):
    print 'Error: unmatched', c, 'line', line_number, 'column', column_number

def check(stack, wanted, c, line_number, column_number):
    if stack[-1] != wanted:
        error(c, line_number, column_number)
    else:
        stack.pop()

def check_parentheses(f):
    stack = list()
    line_number = 0
    for line in f:
        line_number = line_number + 1
        column_number = 0
        for c in line:
            column_number = column_number + 1
            if c == '(' or c == '[' or c == '{':
                stack.append(c)
            elif c == ')':
                check(stack, '(', ')', line_number, column_number)
            elif c == ']':
                check(stack, '[', ']', line_number, column_number)
            elif c == '}':
                check(stack, '{', '}', line_number, column_number)

def main():
    filename = sys.argv[1]
    try:
        f = file(filename)
    except IOError:
        sys.stderr.write('Error: Cannot open file %s' % filename)
        sys.exit(1)
    check_parentheses(f)
    f.close()

main()
捂风挽笑 2024-08-21 15:40:11

删除“while True”行和此位:,

elif line=='':
    break

然后将其替换

for line in filename:
    line=f.readline()

for line in f:

:现在您将循环遍历文件中的行。

接下来,将所有这些内容替换

if line=='(':
    c1=line.count('(')

    c1+=line.count('(')

: if 和 elif 行只是阻止您在应该进行计数时进行计数。如果该行没有您要查找的内容,则计数将为 0,这很好。

这至少应该让您更接近解决方案。

Remove the 'while True' line and this bit:

elif line=='':
    break

and then replace this:

for line in filename:
    line=f.readline()

with this:

for line in f:

Now you'll be looping over the lines in the file.

Next, replace all of these sorts of things:

if line=='(':
    c1=line.count('(')

with:

    c1+=line.count('(')

The if and elif lines are just preventing you from counting when you should. If the line doesn't have what you're looking for the count will be 0, which is fine.

That should at least get you closer to a solution.

还如梦归 2024-08-21 15:40:11

我相信,您正在寻找平衡的符号检查器。最好用栈。

  1. 创建一个空堆栈,

  2. 对于字符串中的每个符号:

    2.1 如果该符号是开始符号,则将其压入堆栈。

    2.2 如果是结束符号,则

    2.2.1 如果堆栈为空,则为 false。

    2.2.2 如果栈顶与结束符号不匹配,则返回 false。 [如果您要检查匹配的大括号,请检查此步骤]

    2.2.3 出栈。

  3. 如果堆栈为空,则返回 true,否则返回 false。

嗯。

I believe, You are looking for balanced symbol checker. It is better to use stack.

  1. Make an empty stack,

  2. For each symbol in the string:

    2.1 If the symbol is an opening symbol, push it on the stack.

    2.2 If it is a closing symbol, then

    2.2.1 If the stack is empty, then it in false.

    2.2.2 If the top of the stack does not match the closing symbol, return false. [check this step if you are checking for matched braces]

    2.2.3 Pop the stack.

  3. Return true if the stack is empty, otherwise false.

hth.

吻安 2024-08-21 15:40:11

我想如果你将: 更改

            if line=='(':
                 c1=line.count('(')
            elif line==')':
                 c2=line.count(')')
            elif line=='[':
                 c3=line.count('[')
            elif line==']':
                 c4=line.count(']')
            elif line=='':
                break

为类似:

SearchFor = ['(', ')', '[', ']']
d = {}
for itm in SearchFor:
    d[itm] = line.count(itm)


# Then do the comparison
if d['['] == d[']'] and  d['('] == d[')']:
     print "Valid Syntax"
else:
     print "Invalid Syntax" #You could look at each to find the exact cause.

和其他人提到的 While True: 。我错过了。 :0)

I think if you change the:

            if line=='(':
                 c1=line.count('(')
            elif line==')':
                 c2=line.count(')')
            elif line=='[':
                 c3=line.count('[')
            elif line==']':
                 c4=line.count(']')
            elif line=='':
                break

to something like:

SearchFor = ['(', ')', '[', ']']
d = {}
for itm in SearchFor:
    d[itm] = line.count(itm)


# Then do the comparison
if d['['] == d[']'] and  d['('] == d[')']:
     print "Valid Syntax"
else:
     print "Invalid Syntax" #You could look at each to find the exact cause.

and the While True: as mentioned by others. I had missed that. :0)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文