如何在正确的情况下获取文件名? [英] How to get the filename in the right case ?

查看:66
本文介绍了如何在正确的情况下获取文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我怎样才能找到正确的文件名大小写?


程序中的背景我使用区分大小写的文件名,就像是需要的。
Python需要。

现在我已经将pdb集成到了程序中,

但是pdb表现得有点奇怪:

在断点处它给出的文件名总是小写的(可能是

这只发生在Windows上)。


所以有办法获得给定文件名的正确大小写的情况?


一个解决方案可能是在我的程序中进行比较总是用

小写,

但是我确定该程序不能在非Windows系统上运行。


顺便说一句,为什么pdb表现那样(Python 2.5)?


谢谢,

Stef Mientki

hello,

How can I find the correct case of a filename ?

Background in my program I use case sensitive filenames, just like
Python requires.
Now I''ve integrated pdb into the program,
but pdb acts somwhat strange:
upon a breakpoint it gives the filename always in lowercase (probably
this only happens on windows).

So is there a way to get the correct case of a given filename in lowercase ?

One solution might be to make the comparison in my program always with
lowercase,
but then I''m sure the program won''t work on non-windows systems.

btw, why does pdb behave that way ( Python 2.5 ) ?

thanks,
Stef Mientki

推荐答案

Stef Mientki写道:
Stef Mientki wrote:

你好,


如何找到正确的c文件名是什么?


我的程序中的背景我使用区分大小写的文件名,就像Python需要的
一样。

现在我已经将pdb集成到程序中,

但是pdb表现得有点奇怪:

在断点处它给出的文件名始终是小写的(可能是

这只发生在Windows上。)


那么有没有办法以小写字母获得给定文件名的正确情况




一个解决方案可能是让我的程序中的比较始终与

小写,

然后我确定程序赢了''在非Windows系统上工作。


顺便说一句,为什么pdb表现那样(Python 2.5)?
hello,

How can I find the correct case of a filename ?

Background in my program I use case sensitive filenames, just like
Python requires.
Now I''ve integrated pdb into the program,
but pdb acts somwhat strange:
upon a breakpoint it gives the filename always in lowercase (probably
this only happens on windows).

So is there a way to get the correct case of a given filename in lowercase
?

One solution might be to make the comparison in my program always with
lowercase,
but then I''m sure the program won''t work on non-windows systems.

btw, why does pdb behave that way ( Python 2.5 ) ?



我对此表示怀疑。它确实没有在unix上,我没有看到任何理由为什么

它应该在Windows上执行 - 因为

中的lower()总数pdb.py等于1,并且用于处理用户输入这样的

为是,y,是和是。或者是什么。


你确定你没有通过更低的()处理内容 - 在嵌入pdb时调用

吗?

Diez

I doubt it does. It sure doesn''t on unix, and I fail to see any reason why
it should do that on windows - given that the total number of lower() in
pdb.py amounts to one, and that''s used to process user-input such
as "Yes", "y", "YES" or whatnot.

Are you sure you are not processing the content through some lower()-call
when embedding pdb?

Diez


Diez B. Roggisch写道:
Diez B. Roggisch wrote:

Stef Mientki写道:

Stef Mientki wrote:


> hello,

如何找到正确的文件名大小写?

背景信息我的程序我使用区分大小写的文件名,就像Python需要的那样。
现在我已经将pdb集成到了程序中,
但pdb的行为有点奇怪:
在断点上它文件名始终为小写(可能
这只发生在Windows上)。

那么是否有办法以小写形式获取给定文件名的正确情况?
/>
一个解决方案可能是让我的程序中的比较总是用小写,
但是我确定程序不能在非Windows系统上工作。

顺便说一下,为什么pdb的行为是这样的(Python 2.5)?
>hello,

How can I find the correct case of a filename ?

Background in my program I use case sensitive filenames, just like
Python requires.
Now I''ve integrated pdb into the program,
but pdb acts somwhat strange:
upon a breakpoint it gives the filename always in lowercase (probably
this only happens on windows).

So is there a way to get the correct case of a given filename in lowercase
?

One solution might be to make the comparison in my program always with
lowercase,
but then I''m sure the program won''t work on non-windows systems.

btw, why does pdb behave that way ( Python 2.5 ) ?



我怀疑它确实如此。它确实没有在unix上,我没有看到任何理由为什么

它应该在Windows上执行 - 因为

中的lower()总数pdb.py等于1,并且用于处理用户输入这样的

为是,y,是和是。或者诸如此类。


I doubt it does. It sure doesn''t on unix, and I fail to see any reason why
it should do that on windows - given that the total number of lower() in
pdb.py amounts to one, and that''s used to process user-input such
as "Yes", "y", "YES" or whatnot.



是的我很确定,有两个原因:

1.当我执行step_into时,跳进一个没有

断点的文件本身(意味着我的程序甚至不知道这个文件),

pdb返回一个小写文件名

2. rpdb2(可能基于或甚至从pdb继承)具有相同的

行为。问rpdb2的作者,我有一些借口(我没有理解)为什么他这样做了。

Yes I''m pretty sure, two reasons:
1. when I perform a step_into, jumping into a file that doesn''t have
breakpoints itself (meaning my program doesn''t even know of this file),
pdb returns a lowercase filename
2. rpdb2 (probably based or even inherited from pdb) has the same
behavior. Asking the writer of rpdb2, I got some excuse (which I didn''t
understand) why he had done it that way.


你确定你没有处理内容通过一些较低的() - 嵌入pdb时调用



Are you sure you are not processing the content through some lower()-call
when embedding pdb?



但是也许pdb呢?


谢谢,

Stef

But maybe pdb does ?

thanks anyway,
Stef


>

Diez

-
http://mail.python.org/mailman/listinfo/python-list


是的,我很确定,两个原因:
Yes I''m pretty sure, two reasons:

1.当我执行step_into时,跳转到一个没有自己的b $ b断点的文件(意思是我的程序甚至不知道这个文件),

pdb返回小写文件名
1. when I perform a step_into, jumping into a file that doesn''t have
breakpoints itself (meaning my program doesn''t even know of this file),
pdb returns a lowercase filename



什么ha与潜在的输出后处理有关吗?

What has that to do with potential output postprocessing?


2. rpdb2(可能基于或甚至从pdb继承)具有相同的

行为。问rpdb2的作者,我有一些借口(我没有理解)为什么他这样做了。
2. rpdb2 (probably based or even inherited from pdb) has the same
behavior. Asking the writer of rpdb2, I got some excuse (which I didn''t
understand) why he had done it that way.



rpdb2不是pdb。


下面是我刚刚拥有的Pdb会话的输出:

(eggbasket)dir @ client8049:〜/ software / vc / EggBasket

rpdb2 is not pdb.

Below is the output of a Pdb-session I just had:
(eggbasket)dir@client8049:~/software/vc/EggBasket


这篇关于如何在正确的情况下获取文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆