1

There are different files in a folder, I would like to print files which are ended with IHDRT.exr. The correct answer for this job is as shown bellow:

    #!/usr/bin/env python
    import glob

    for file in glob.glob("*.exr"):
        if file.endswith('iHDRT.exr'):
            print(file)
Cagri
  • 657
  • 2
  • 8
  • 17

2 Answers2

2
#!/usr/bin/env python
import glob

for file in glob.glob("*.exr"):
    if file.endswith('iHDRT.exr'):
            ^^^^^^^^
        print(file)

Its endswith and not endswidth

vks
  • 67,027
  • 10
  • 91
  • 124
1

Use endswith, not endswidth! Error spelling

JRazor
  • 2,707
  • 18
  • 27