How to open and read an unknown extension file
varnikat t
varnikat22 at gmail.com
Fri Apr 9 09:00:51 EDT 2010
Hey thanks a lot to all of you....Now i understood the concept and can use
it the right way....
I have another doubt regarding using radio buttons....
I am using two radio buttons for user to select either of the two options:
Landscape
Portrait
When i run the program it shows both radio buttons are active
I don't know how to toggle between the two radio buttons.
Also I want to display the respective image with them Landscape and portrait
at the top of each option....Can anyone help me with this?
On Fri, Apr 9, 2010 at 6:05 AM, Tim Chase <python.list at tim.thechases.com>wrote:
> On 04/08/2010 12:22 PM, varnikat t wrote:
>
>> it gives me this error
>>
>> TypeError: coercing to Unicode: need string or buffer, list found
>>
>>> Thanks for the help.it detects now using glob.glob("*.*.txt")
>>>
>>> Can u suggest how to open and read file this way?
>>>
>>> *if glob.glob("*.*.txt"):
>>> file=open(glob.glob("*.*.txt"))
>>>
>>> self.text_view.get_buffer().set_text(file.read())
>>> else:
>>> file=open(glob.glob("*.*.html"))
>>>
>>> self.text_view.get_buffer().set_text(file.read())
>>>
>>
> glob() returns a list of matching files, not a string. So you need to
> iterate over those files:
>
> filenames = glob.glob('*.*.txt')
> if filenames:
> for filename in filenames:
> do_something_text(filename)
> else:
> for filename in glob('*.*.html'):
> do_something_html(filename)
>
> -tkc
>
>
>
>
--
Varnika Tewari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100409/ed902f49/attachment-0001.html>
More information about the Python-list
mailing list