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
  • 607
  • 1
  • 7
  • 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
  • 65,133
  • 10
  • 87
  • 119
1

Use endswith, not endswidth! Error spelling

JRazor
  • 2,488
  • 17
  • 26