if file is not None: content = file.readlines() if 'I' and 'J' in content: display_oval() else: display_polygon()
in this case,suppose i opened a file containing I&J . i expect to call
display_oval() but it calls
display_polygon(). when i opened file not containing I&J,
display_polygon() calls as expected.
when i replaced
'I' and 'J'with
'I' or 'J',when i opened a file containing I&J,
display_oval() works fine. But when i opened file not containing I&J, nothing works.
I want to call
display_oval()if file contains I&J and
display_polygon()otherwise. how it can be done?
Source: Python-3x Questions