El martes, 7 de mayo de 2013 23:53:32 UTC+2, Terry Jan Reedy escribió: > On 5/7/2013 4:27 PM, cheirasa...@gmail.com wrote: > > > > > file = filedialog.askopenfile ( mode....... ) > > > > askopenfile is a convenience function that creates an Open dialog > > object, shows it, gets the name returned by the dialog, opens the file > > with that name, and returns an appropriate normal file object > > > > > to open a file with an open dialog box, OK. Made it. > > > > > > How i get the name of the opened file? > > > > file.name, (at least in 3.3), which in your example below is "file.doc" > > > > > print(file) > > > > > > the output is: <......name="file.doc"...mode=......encoding.......... > > > > > This is the standard string representation of a file object. It is > > created from the various attributes of the file instance, including > > file.name. > > > > > How can i get the second member of 'file'? > > > > Strings do not have fields. The second 'member', would be the second > > character, file[1], which is not what you want. > > > > > And i am unable to find a detailed reference to this object in the i.net > > > > Use the Fine Manual. The entry for builtin open() function, which you > > should read to understand the 'open' part of askopenfile, directs you to > > the Glossary entry 'file object' which says "There are actually three > > categories of file objects: raw binary files, buffered binary files and > > text files. Their interfaces are defined in the io module. The canonical > > way to create a file object is by using the open() function." The kind > > of file object you get is determined by the mode ('b' present or not), > > buffer arg, and maybe something else. You can look in the io chapter or > > use dir() and help() as John G. suggested. > > > > Python programmers should really learn to use dir(), help(), and the > > manuls, including the index and module index. > > > > -- > > Terry Jan Reedy
Yeah. This is an answer. A lot of thanks. -- http://mail.python.org/mailman/listinfo/python-list